File: pythran-test-cases

package info (click to toggle)
pythran 0.17.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 12,700 kB
  • sloc: cpp: 65,021; python: 41,083; sh: 137; makefile: 87
file content (87 lines) | stat: -rw-r--r-- 2,886 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
#
# This autopkgtest runs only specific test files instead of the full
# suite, as upstream test suite is very time consuming.

set -e -u

DEB_HOST_ARCH=$( dpkg-architecture -qDEB_HOST_ARCH )

if [ "${DEB_HOST_ARCH}" = "riscv64" ] ; then
    # riscv64 runs extremely slowly, run on default python only
    PYVERS=$(py3versions -d)
else
    PYVERS=$(py3versions -s)
fi

# use XSIMD acceleration on supported architectures
CXXFLAGS=
case " amd64 arm64 i386 " in
  *\ ${DEB_HOST_ARCH}\ *)  export CXXFLAGS=-DUSE_XSIMD;;
esac

if [ "${DEB_HOST_ARCH}" = "i386" ] ; then
    export CXXFLAGS="${CXXFLAGS} -march=native"
fi


TEST_FILES="test_cases.py"
# * test_cases: suggested by upstream [1].
# [1] https://github.com/serge-sans-paille/pythran/issues/908#issuecomment-945378742

# Additionally, some tests are excluded manually:
# * due to its duration, based on the output of "pytest --durations=0".
# * loopy_jacob is excluded due to failing, seemingly related to:
# https://github.com/serge-sans-paille/pythran/issues/1963

declare -a SKIP_TEST_LIST

# test_case test_multitype_run* fails with gcc-12, cf Bug#1016155,
# see https://github.com/serge-sans-paille/pythran/issues/2011
SKIP_TEST_LIST=(${SKIP_TEST_LIST[@]} test_rbfinterp test_shallow_water test_compute_subpix_2d_gaussian2 loopy_jacob test_multitype_run)

TEST_SELECTOR=""
list_initialised=0
for t in ${SKIP_TEST_LIST[@]}; do
    if [ ${list_initialised} = 0 ]; then
        TEST_SELECTOR=$t
        list_initialised=1
    else
        TEST_SELECTOR="${TEST_SELECTOR} or $t"
    fi
done
if [ "x${TEST_SELECTOR}" != "x" ]; then
    TEST_SELECTOR="not ( ${TEST_SELECTOR} )"
fi

if [ "${DEB_HOST_ARCH}" = "riscv64" ] ; then
    # riscv64 runs extremely slowly such that the test session times out
    # so use a restricted subset
    all_cases=($(cd pythran/tests/cases; ls *.py))
    few_cases=${all_cases[0]%.py}
    n=3  # only run every 3rd test case
    for ((i=n-1; i<${#all_cases[@]}; i+=n)); do
	few_cases="${few_cases} or ${all_cases[$i]%.py}"
    done
    TEST_SELECTOR="${few_cases} and ${TEST_SELECTOR}"
    echo "On ${DEB_HOST_ARCH} only running ${few_cases}"
fi

echo "skipping tests with SKIP_TEST_LIST=${SKIP_TEST_LIST[@]}"

# Copy upstream "pythran.tests" to a new package, as it is not part of
# the installed packages but the test files import from it.
cp -r pythran/tests $AUTOPKGTEST_TMP/pythran_tests
cd $AUTOPKGTEST_TMP/pythran_tests
find . -type f -name "*.py" -print0 | xargs -0 sed -i 's|pythran\.tests|pythran_tests|g'

# test_rosetta contains hard-coded references to a file relative to the
# package directory.
sed -i 's|pythran/tests/rosetta/read_conf.cfg|rosetta/read_conf.cfg|g' rosetta/*

for py in ${PYVERS}; do
    echo "Running testsuite with $py using CXXFLAGS=${CXXFLAGS}"
    for test_file in $TEST_FILES; do
        $py -m pytest $test_file -k "${TEST_SELECTOR}"
    done
done