-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding "udmi validate" tool #561
Changes from all commits
676eb99
3e6f767
5c7bbc7
908bc39
7dafff7
375775c
8ed9b78
9d0e805
055460d
886d188
b205695
b125d1d
a15004e
038096a
c3d3aa1
61b4682
40573aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
#!/bin/bash -e | ||
|
||
UDMI_ROOT=$(realpath $(dirname $(readlink -f $0))/..) | ||
|
||
source $UDMI_ROOT/etc/shell_common.sh | ||
|
||
source $UDMI_ROOT/etc/find_udmi_profile.sh | ||
source $(realpath $(dirname $(readlink -f $0))/..)/etc/udmi_preamble.sh | ||
|
||
echo profile: ${udmi_profile} | ||
echo site_model: ${site_model} | ||
echo site_model: ${udmi_site} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there some reason these aren't named same_as_the_others instead of using - ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was basing it off of the git extension format, e.g. the file "git-utility" would map to the command-line "git utility " -- as a way to provide transparent extensions. So, "udmi-validate" maps to "udmi validate". The snake_case ones are generally things then that should be run directly (bin/test_sequencer). So, that was the reason (consistency with git extension naming)... |
||
UDMI_ROOT=$(realpath $(dirname $(readlink -f $0))/..) | ||
source $(realpath $(dirname $(readlink -f $0))/..)/etc/udmi_preamble.sh | ||
|
||
cd $UDMI_ROOT | ||
[[ $udmi_site != null ]] || udmi_help site_model not defined | ||
[[ $udmi_project != null ]] || udmi_help project_id not defined | ||
[[ $udmi_device != null ]] || udmi_help device_id not defined | ||
[[ $udmi_serial != null ]] || udmi_help serial_id not defined | ||
|
||
source etc/shell_common.sh | ||
|
||
source etc/find_udmi_profile.sh | ||
|
||
source etc/extract_parameters.sh | ||
|
||
[[ $udmi_project != null ]] || (echo project_id not defined && false) | ||
[[ $udmi_device != null ]] || (echo device_id not defined && false) | ||
[[ $udmi_serial != null ]] || (echo serial_id not defined && false) | ||
|
||
echo $UDMI_ROOT/bin/pubber $site_model $udmi_project $udmi_device $udmi_serial $* | ||
$UDMI_ROOT/bin/pubber $site_model $udmi_project $udmi_device $udmi_serial $* | ||
cmd="$UDMI_ROOT/bin/pubber $udmi_site $udmi_project $udmi_device $udmi_serial $*" | ||
echo $cmd | ||
$cmd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash -e | ||
|
||
source $(realpath $(dirname $(readlink -f $0))/..)/etc/udmi_preamble.sh | ||
|
||
CONFIG_FILE=/tmp/validator_config.json | ||
|
||
echo $udmi_site | ||
[[ $udmi_site != null ]] || udmi_help site_model not defined | ||
[[ $udmi_project != null ]] || udmi_help project_id not defined | ||
|
||
[[ $udmi_feed != null ]] || udmi_feed= | ||
|
||
SUMMARY_FILE=out/validation_report.json | ||
rm -f $SUMMARY_FILE | ||
|
||
$UDMI_ROOT/validator/bin/build | ||
|
||
echo Writing config to $CONFIG_FILE | ||
cat <<EOF > $CONFIG_FILE | ||
{ | ||
"project_id": "$udmi_project", | ||
"site_model": "$udmi_site", | ||
"log_level": "$udmi_loglevel", | ||
"udmi_root": "$UDMI_ROOT", | ||
"feed_name": "$udmi_feed", | ||
"udmi_version": "$udmi_version", | ||
"key_file": "$site_path/validator/rsa_private.pkcs8" | ||
} | ||
EOF | ||
|
||
JAVA_CMD="java -cp $UDMI_JAR com.google.daq.mqtt.validator.Validator" | ||
|
||
cmd="$JAVA_CMD $CONFIG_FILE" | ||
if [[ $udmi_runsec != null ]]; then | ||
cmd="timeout ${udmi_runsec}s $cmd" | ||
fi | ||
|
||
echo $cmd | ||
result=0 | ||
$cmd || result=$? | ||
|
||
if [[ $result != 124 ]]; then | ||
echo abnormal termination not due to timeout. | ||
false | ||
fi | ||
|
||
[[ -f $SUMMARY_FILE ]] || (echo missing summary file $SUMMARY_FILE && false) | ||
|
||
mkdir -p out/devices | ||
|
||
error_files=$(find out/devices/ -name \*.out) | ||
echo | ||
if [[ -n $error_files ]]; then | ||
echo Device validation error files: | ||
find out/devices/ -name \*.out | ||
else | ||
echo No device validation errors found. | ||
fi | ||
echo | ||
echo Report summary in $SUMMARY_FILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly all this source'ing makes me nervous. Is there some other way we can accomplish this?
If we just want to put configuration data into shell scripts that's one thing, and carefully pull the values out. But at the point that we are building multiple source (with sourceing them) shell scripts I think we might need a different approach.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how else to do it other than with "source" -- if you have a specific suggestion on "some other way" that's more appropriate then I'm all ears... but -- if you want/need to do something like define "common functions" I'm not sure how else to do it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think if you are sourcing shell scripts you need to move to a different language.