Skip to content
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

Clean up generated sequence md formatting and messages #1019

Merged
merged 41 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
56acd1d
Adding optional rescriptions
grafnu Nov 4, 2024
a14f74a
Fixing system log
grafnu Nov 4, 2024
6eebc40
Minor text tweak
grafnu Nov 4, 2024
b5c8d62
Fixing broken json config update
grafnu Nov 4, 2024
61dd570
Fixing some logging messages
grafnu Nov 4, 2024
a358d81
Linty fix
grafnu Nov 4, 2024
79b986a
Removing extra
grafnu Nov 4, 2024
9ded064
Updating sequences
grafnu Nov 4, 2024
034a519
Fixing output
grafnu Nov 4, 2024
0e4a435
Capture active capability
grafnu Nov 4, 2024
af8cdb1
Adding closing check
grafnu Nov 4, 2024
b6926ec
Adding not system status check
grafnu Nov 4, 2024
6079fe1
Start to be clever
grafnu Nov 4, 2024
1478e01
Fix random typos
grafnu Nov 4, 2024
50fa5b4
pretendStateUpdated
grafnu Nov 5, 2024
7689bec
Adding failed wait for recorded sequence
grafnu Nov 5, 2024
2b318b9
Linty unit
grafnu Nov 5, 2024
5ae126b
Test output fixup
grafnu Nov 5, 2024
6169883
Merge branch 'master' into deltabreak
grafnu Nov 5, 2024
e2082c1
Adjusting out
grafnu Nov 5, 2024
f806337
Fixing NPE for missing subFolder
grafnu Nov 6, 2024
d414684
Fixing some results
grafnu Nov 6, 2024
83674e9
Fix error handling for received state with no-state
grafnu Nov 6, 2024
ac3656c
FIxing outpus
grafnu Nov 6, 2024
5399e3d
Cleanup output log handling
grafnu Nov 6, 2024
ff9c277
Change error line
grafnu Nov 6, 2024
da8ebbc
Fix expected
grafnu Nov 6, 2024
8fdf5c6
Include more detail in exception message
grafnu Nov 6, 2024
351a7b9
Fix line length
grafnu Nov 6, 2024
0e3eb60
Fix result summarizer
grafnu Nov 6, 2024
519b830
Updating
grafnu Nov 6, 2024
446387e
Add checing info
grafnu Nov 6, 2024
f5b3df9
PubSub publisher tweaks
grafnu Nov 6, 2024
b2a557d
Fix test output
grafnu Nov 6, 2024
75236b0
Updating output
grafnu Nov 6, 2024
382437c
FIx python error
grafnu Nov 6, 2024
d480f41
Fixing pylint
grafnu Nov 6, 2024
9d67bdc
Only sequences
grafnu Nov 6, 2024
041483c
Merge branch 'sequences' into deltabreak
grafnu Nov 6, 2024
bd6b4c9
Removing old sequence logs
grafnu Nov 6, 2024
ca60401
Merge branch 'sequences' into deltabreak
grafnu Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions bin/augment_metadata
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#

if [[ $# -lt 2 ]]; then
echo Usage: $0 SITE_DIR DEVICE_ID [PUBBER_OPTS...]
echo Usage: $0 SITE_DIR DEVICE_ID [METADATA_OPTS...]
false
fi

site_dir=$(realpath $1)
device_id=$2
shift 2
pubber_opts=$*
metadata_opts=$*

nostate=false
if [[ $pubber_opts =~ noState ]]; then
if [[ $metadata_opts =~ noState ]]; then
nostate=true
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/sequencer
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ echo
echo Extracting sequence results:
# Sort by test name (6th field)
egrep 'RESULT |CPBLTY ' $SEQUENCER_LOG | fgrep NOTICE | sort -k 6 | \
sed -e 's/.* NOTICE //' | tee $SEQUENCER_OUT
sed -E -e 's/.* NOTICE +//' | tee $SEQUENCER_OUT

[[ -s $SEQUENCER_OUT ]] || fail No test results found.

Expand Down
22 changes: 13 additions & 9 deletions bin/sequencer_report
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,19 @@ class Sequence:
buffer = []
steps = []

file_lines = text.splitlines()
start_index = first_occurence(file_lines, lambda x: x[:2] == "1.")
sequence_lines = file_lines[start_index:]

for line in reversed(sequence_lines):
buffer.insert(0, line)
if re.match(cls.STEP_PREFIX, line):
steps.insert(0, SequenceStep(buffer.copy()))
buffer.clear()
try:
file_lines = text.splitlines()
start_index = first_occurence(file_lines, lambda x: x[:2] == "1.")
sequence_lines = file_lines[start_index:]

for line in reversed(sequence_lines):
buffer.insert(0, line)
if re.match(cls.STEP_PREFIX, line):
steps.insert(0, SequenceStep(buffer.copy()))
buffer.clear()
# pylint: disable-next=bare-except
except:
pass
return steps

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion bin/test_itemized
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ else
while read result; do
# Two ?s matches the printf %02d above.
expected=${result/#?? /}
fgrep "$expected" $GOLDEN_FILE || fail Expected result not found: $expected
echo Checking $GOLDEN_FILE for result: $expected
fgrep "$expected" $GOLDEN_FILE || fail Expected result not found: $result
done < $RESULTS_OUT
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/test_sequcheck
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ echo '####################' Starting gencode_seq tests
mv $UDMI_ROOT/docs/specs/sequences/generated.md out/generated${suffix}.out
mv out/generated.tmp $UDMI_ROOT/docs/specs/sequences/generated.md

echo Comparing diff out/generated${suffix}.out docs/specs/sequences/generated.md
echo Comparing diff out/generated${suffix}.out $UDMI_ROOT/docs/specs/sequences/generated.md
diff -u out/generated${suffix}.out $UDMI_ROOT/docs/specs/sequences/generated.md || failures+="gencode_seq "
echo '####################' Finished gencode_seq tests: $failures

Expand Down
9 changes: 5 additions & 4 deletions bin/test_sequencer
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ echo Writing pubber output to $PUBBER_LOG
echo bin/pubber $site_path $project_id $device_id $serial_no $pubber_opts
bin/pubber $site_path $project_id $device_id $serial_no $pubber_opts > $PUBBER_LOG 2>&1 &

WAITING=10
WAITING=20
for i in `seq 1 $WAITING`; do
echo Waiting for pubber startup $((WAITING - i))...
sleep 1
if fgrep "Connection complete" $PUBBER_LOG; then
break
fi
echo Waiting for pubber startup $((WAITING - i))...
sleep 2
done

if [[ $i -eq $WAITING ]]; then
Expand Down Expand Up @@ -193,7 +193,8 @@ fi
GOLDEN_FILE=etc/sequencer${suffix}.out
echo Checking for correctness of completed tests in $GOLDEN_FILE...
while read result; do
fgrep "$result" $GOLDEN_FILE || fail Expected result not found for $result
echo Checking $GOLDEN_FILE for expected result: $result
fgrep "$result" $GOLDEN_FILE || fail Expected result not found: $result
done < out/sequencer${suffix}.out.save

echo Done with $suffix test_sequencer run.
7 changes: 7 additions & 0 deletions common/src/main/java/com/google/udmi/util/GeneralUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ public static List<String> friendlyLineTrace(Throwable e) {
return messages;
}

public static String getRootCause(Throwable e) {
while (e.getCause() != null) {
e = e.getCause();
}
return e.getMessage();
}

private static <T> T fromJsonFile(File path, Class<T> valueType, ObjectMapper objectMapper) {
try {
return OBJECT_MAPPER_STRICT.readValue(path, valueType);
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/com/google/udmi/util/JsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public static void safeSleep(long sleepTimeMs) {
try {
Thread.sleep(sleepTimeMs);
} catch (Exception e) {
throw new RuntimeException("Interrupted sleep", e);
throw new RuntimeException("Interrupted safe sleep", e);
}
}

Expand Down
Loading