forked from TraceMachina/nativelink-blogs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_provider.sh
More file actions
executable file
·30 lines (25 loc) · 832 Bytes
/
python_provider.sh
File metadata and controls
executable file
·30 lines (25 loc) · 832 Bytes
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
#!/usr/bin/env bash
# Generic Python test wrapper that handles cross-architecture execution
# Get the directory where this script is located
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# First argument is the Python module or script to run
PYTHON_SCRIPT="$1"
# Remaining arguments are passed to the Python script
shift
echo "Running Python test: $PYTHON_SCRIPT"
echo "Python version:"
python3 --version
# Check if the argument is a file or a module
if [[ -f "$PYTHON_SCRIPT" ]]; then
# Run as a script if it's a file
echo "Running as script"
python3 "$PYTHON_SCRIPT" "$@"
else
# Run as a module if it's not a file
echo "Running as module"
python3 -m "$PYTHON_SCRIPT" "$@"
fi
# Capture and return the exit code
exit_code=$?
echo "Python test completed with exit code: $exit_code"
exit $exit_code