-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrunlabview.sh
More file actions
74 lines (61 loc) · 2.27 KB
/
runlabview.sh
File metadata and controls
74 lines (61 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
CONFIG_FILE='/workspace/Test-VIs/viaPassCase.viancfg'
LABVIEW_PATH='/usr/local/natinst/LabVIEW-2025-64/labviewprofull'
REPORT_PATH='/usr/local/natinst/ContainerExamples/Results.txt'
MASSCOMPILE_DIR='/workspace/Test-VIs'
# Verify that the configuration file exists.
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: Configuration file not found at $CONFIG_FILE, exiting...!"
exit 1
fi
echo "Running LabVIEWCLI MassCompile with following parameters:"
echo "DirectorytoCompile: $MASSCOMPILE_DIR"
OUTPUT_MASSCOMPILE=$(LabVIEWCLI -LogToConsole TRUE \
-OperationName MassCompile \
-DirectoryToCompile $MASSCOMPILE_DIR \
-LabVIEWPath $LABVIEW_PATH)
echo " "
echo "Done Running Masscompile Operation"
echo "Printing Results..."
echo " "
echo "########################################################################################"
echo $OUTPUT_MASSCOMPILE
echo "########################################################################################"
echo " "
echo "Running LabVIEWCLI VIAnalyzer with the following parameters:"
echo "ConfigPath: $CONFIG_FILE"
echo "ReportPath: $REPORT_PATH"
echo " "
# Run the LabVIEWCLI VIA command.
OUTPUT=$(LabVIEWCLI -LogToConsole TRUE \
-OperationName RunVIAnalyzer \
-ConfigPath $CONFIG_FILE \
-ReportPath $REPORT_PATH \
-LabVIEWPath $LABVIEW_PATH)
echo "Done running of VI Analyzer Tests"
echo "Printing Results..."
echo " "
echo "########################################################################################"
cat "$REPORT_PATH"
# 1) Extract the number from the report file, anchor to “Failed Tests”
FAILED_COUNT=$(
sed -n 's/^Failed Tests[[:space:]]*\([0-9]\+\)$/\1/p' "$REPORT_PATH"
)
# 2) Default to zero if it didn’t match
: "${FAILED_COUNT:=0}"
# 3) Sanity-check numeric
if ! [[ "$FAILED_COUNT" =~ ^[0-9]+$ ]]; then
echo "Warning: parsed FAILED_COUNT ('$FAILED_COUNT') is not numeric, defaulting to 0" >&2
FAILED_COUNT=0
fi
echo "Number of failed tests: $FAILED_COUNT"
# 4) Exit based on count
if (( FAILED_COUNT > 0 )); then
echo "✖ Some tests failed. Exiting with error."
echo "########################################################################################"
exit 1
else
echo "✔ All tests passed."
echo "########################################################################################"
exit 0
fi