-
Notifications
You must be signed in to change notification settings - Fork 18
/
run_tests.sh
executable file
·93 lines (86 loc) · 3.03 KB
/
run_tests.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Default values
input="."
publisher=""
subscriber=""
output=""
# Function to display usage information
usage() {
echo "Run the interoperability_report script for the specified applications."
echo "If a publisher/subscriber is provided only that publisher/subscriber"
echo "is used as a publisher or subscriber application. If a publisher or"
echo "subscriber is not provided, this script will find and use all "
echo "'*_shape_main_linux' applications in the input directory as publisher and"
echo "subscribers."
echo "Usage: $0 [-p publisher] [-s subscriber] [-o output] [-i input] [-h]"
echo "Options:"
echo " -p, --publisher Specify the publisher application"
echo " -s, --subscriber Specify the subscriber application"
echo " -o, --output Specify the output XML file"
echo " -i, --input Specify the directory where publisher/subscriber applications are located (only if -p and -s are not provided)"
echo " -h, --help Print this help message"
echo "Examples:"
echo "Run Connext as publisher and all executables under './executables' as subscribers"
echo " ./run_tests.sh -p connext_dds-6.1.2_shape_main_linux -i ./executables"
exit 1
}
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-p|--publisher)
publisher="$2"
shift 2
;;
-s|--subscriber)
subscriber="$2"
shift 2
;;
-o|--output)
output="$2"
shift 2
;;
-i|--input)
input="$2"
shift 2
;;
-h|--help)
usage
;;
*)
echo "Error: Unknown option $1"
usage
;;
esac
done
# If publisher is not provided, find publisher applications
if [[ -z $publisher ]]; then
echo "Searching for publisher applications in directory: $input"
publisher=$(find "$input" -type f -name '*_shape_main_linux')
fi
# If subscriber is not provided, find subscriber applications
if [[ -z $subscriber ]]; then
echo "Searching for subscriber applications in directory: $input"
subscriber=$(find "$input" -type f -name '*shape_main_linux')
fi
# Check if required options are provided
if [[ -z $publisher || -z $subscriber ]]; then
echo "Error: Unable to find publisher or subscriber applications."
usage
fi
# Run the application logic
for i in $publisher; do
for j in $subscriber; do
publisher_name=$(basename "$i" _shape_main_linux)
subscriber_name=$(basename "$j" _shape_main_linux)
echo "Testing Publisher $publisher_name --- Subscriber $subscriber_name"
if [[ -n $output ]]; then
python3 ./interoperability_report.py -P "$i" -S "$j" -o "$output"
else
python3 ./interoperability_report.py -P "$i" -S "$j"
fi
if [ -d "./OpenDDS-durable-data-dir" ]; then
echo Deleting OpenDDS-durable-data-dir;
rm -rf ./OpenDDS-durable-data-dir;
fi;
done
done