| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
cd "$(dirname "$0")" |
| 5 |
|
| 6 |
> control |
| 7 |
|
| 8 |
# Note: Some tests are explicitly skipped because they require specific hardware (like TPU, multi-device), |
| 9 |
# or they were commented out in the original control file (like big_modeling, modeling_utils). |
| 10 |
SKIP_TESTS=( |
| 11 |
"test_big_modeling" |
| 12 |
"test_cli" |
| 13 |
"test_cpu" |
| 14 |
"test_dataclasses" |
| 15 |
"test_modeling_utils" |
| 16 |
"test_multidevice" |
| 17 |
"test_tpu" |
| 18 |
) |
| 19 |
|
| 20 |
# Function to check if an element is in an array |
| 21 |
containsElement() { |
| 22 |
local e match="$1" |
| 23 |
shift |
| 24 |
for e; do [[ "$e" == "$match" ]] && return 0; done |
| 25 |
return 1 |
| 26 |
} |
| 27 |
|
| 28 |
for f in ../../tests/test_*.py; do |
| 29 |
# Fallback in case there are no files |
| 30 |
[ -e "$f" ] || continue |
| 31 |
|
| 32 |
base=$(basename "$f" .py) |
| 33 |
|
| 34 |
if containsElement "$base" "${SKIP_TESTS[@]}"; then |
| 35 |
continue |
| 36 |
fi |
| 37 |
|
| 38 |
test_name=$(echo "$base" | sed 's/_/-/g' | sed 's/^test-/pytest-/') |
| 39 |
|
| 40 |
echo "Test-Command: HOME=\$AUTOPKGTEST_TMP pytest-3 -v tests/${base}.py" >> control |
| 41 |
echo "Depends: python3-pytest," >> control |
| 42 |
echo " python3-pytest-env," >> control |
| 43 |
echo " python3-pytest-mock," >> control |
| 44 |
echo " python3-parameterized," >> control |
| 45 |
|
| 46 |
if [[ "$base" == "test_compile" ]]; then |
| 47 |
echo " python3-wheel," >> control |
| 48 |
echo " python3-setuptools," >> control |
| 49 |
fi |
| 50 |
|
| 51 |
if [[ "$base" == "test_utils" ]]; then |
| 52 |
echo " python3-wheel," >> control |
| 53 |
echo " python3-setuptools," >> control |
| 54 |
echo " libtorch-dev," >> control |
| 55 |
echo " libsleef-dev," >> control |
| 56 |
echo " @," >> control |
| 57 |
echo " g++," >> control |
| 58 |
else |
| 59 |
echo " @" >> control |
| 60 |
fi |
| 61 |
|
| 62 |
echo "Restrictions: allow-stderr" >> control |
| 63 |
echo "Features: test-name=${test_name}" >> control |
| 64 |
if [[ "$base" == "test_utils" ]]; then |
| 65 |
echo "Architecture: !s390x" >> control |
| 66 |
fi |
| 67 |
|
| 68 |
echo "" >> control |
| 69 |
done |