forked from ArgLab/writing_observer
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·43 lines (37 loc) · 1.19 KB
/
test.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.19 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
#!/bin/bash
# test.sh
# This script iterates over the passed in `PACKAGES`,
# change directory to that path, and execute the `test.sh`
# file.
set -e # Exit immediately if a command exits with a non-zero status
# Parse arguments
PACKAGES=("$@")
# Check for no arguments
if [ ${#PACKAGES[@]} -eq 0 ]; then
echo "Error: No packages specified."
echo "Usage:"
echo "$0 /path/to/package_a path/to/package_b ..."
echo "or"
echo "make test PKG=/path/to/package_a"
exit 1
fi
echo "Running tests for: ${PACKAGES[*]}"
# Run tests for each package
for package in "${PACKAGES[@]}"; do
ABS_PACKAGE_PATH="$(cd "$(dirname "$package")" && pwd)/$(basename "$package")/"
PACKAGE_TEST_SCRIPT="$ABS_PACKAGE_PATH/test.sh"
# Debug directory
if [ -d "$ABS_PACKAGE_PATH" ]; then
echo "Directory exists: $ABS_PACKAGE_PATH"
else
echo "Warning: Directory does not exist: $ABS_PACKAGE_PATH, skipping."
continue
fi
# Check if the file exists
if [ -f "$PACKAGE_TEST_SCRIPT" ]; then
echo "Running $PACKAGE_TEST_SCRIPT..."
(cd "$ABS_PACKAGE_PATH" && ./test.sh)
else
echo "Warning: No test.sh found in $package, skipping."
fi
done