-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsamples.sh
More file actions
executable file
·65 lines (57 loc) · 1.99 KB
/
samples.sh
File metadata and controls
executable file
·65 lines (57 loc) · 1.99 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
#!/bin/bash
# Set the path to the twister executable
TWISTER_EXE=""
# Set workspace virtual environment if available
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
WORKSPACE_VENV="$SCRIPT_DIR/../.venv"
WORKSPACE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
TWISTER_EXE="$WORKSPACE_DIR/zephyr/scripts/twister"
if [ -x "$WORKSPACE_VENV/bin/python3" ]; then
VENV_SITE="$($WORKSPACE_VENV/bin/python3 -c 'import site; print(site.getsitepackages()[0])')"
export PATH="$WORKSPACE_VENV/bin:$PATH"
export PYTHONPATH="$VENV_SITE${PYTHONPATH:+:$PYTHONPATH}"
fi
# Set the path to the test cases directory
TEST_CASES_DIR="$SCRIPT_DIR/zephyr/samples"
# Set the output directory for test results
OUTPUT_DIR="$SCRIPT_DIR/twister-out.samples"
# Remove the output directory
rm -rf "$OUTPUT_DIR"
# Run twister with the specified test cases and output directory
"$TWISTER_EXE" -O "$OUTPUT_DIR" -T "$TEST_CASES_DIR"
TWISTER_RC=$?
# twister output directory cleanup files we do not archive
find "$OUTPUT_DIR" -name 'CMakeFiles' -exec rm -rf {} \; 2>/dev/null
find "$OUTPUT_DIR" -name 'modules' -exec rm -rf {} \; 2>/dev/null
find "$OUTPUT_DIR" -name 'app' -exec rm -rf \
'{}/../zephyr/arch
{}/../zephyr/boards
{}/../zephyr/cmake
{}/../zephyr/CMakeFiles
{}/../zephyr/dev_graph.dot
{}/../zephyr/drivers
{}/../zephyr/dts.cmake
{}/../zephyr/edt.pickle
{}/../zephyr/include
{}/../zephyr/isrList.bin
{}/../zephyr/kconfig
{}/../zephyr/kernel
{}/../zephyr/lib
{}/../zephyr/libzephyr.a
{}/../zephyr/misc
{}/../zephyr/modules
{}/../zephyr/soc
{}/../zephyr/subsys
{}/../Makefile
{}/../Kconfig
{}/../cmake_install.cmake
{}/../CMakeCache.txt' \; 2>/dev/null
find "$OUTPUT_DIR" -name 'app' -exec rm -rf '{}' \; 2>/dev/null
echo "Twister samples output cleanup completed successfully."
# Check if twister ran successfully
if [ $TWISTER_RC -eq 0 ]; then
echo "Twister samples testing completed successfully."
else
echo "Twister samples testing failed."
exit 1
fi