File: test_script.sh

package info (click to toggle)
dmlc-core 0.5%2Bgit20240614.1334185-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,672 kB
  • sloc: cpp: 16,312; python: 1,421; ansic: 1,014; java: 802; makefile: 236; sh: 140; xml: 138
file content (70 lines) | stat: -rwxr-xr-x 2,705 bytes parent folder | download
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
#!/bin/bash

set -e
set -x

if [[ ${TASK} == "lint" ]]; then
    # Disable pylint for now as they are not yet fixed.
    # stop the build if there are Python syntax errors or undefined names
    # python3 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
    # exit-zero treats all errors as warnings.  The GitHub editor is 127 chars wide
    # python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

    make lint
    make doxygen 2>log.txt
    (cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag" |grep warning) && exit 1
    exit 0
fi

# For all tests other than s390x_test, expect little endian
export DMLC_UNIT_TEST_LITTLE_ENDIAN=1

if [[ ${TASK} == "unittest_gtest" ]]; then
    cp make/config.mk .
    if [[ $(uname) != "Darwin" ]]; then
        echo "USE_S3=1" >> config.mk
        echo "export CXX = g++" >> config.mk
        export CXX=g++
    else
        echo "USE_S3=0" >> config.mk
        echo "USE_OPENMP=1" >> config.mk
        echo "export CXX=g++-11" >> config.mk
        export CXX=g++-11
    fi
    make -f scripts/packages.mk gtest
    echo "GTEST_PATH="/tmp/gtest >> config.mk
    echo "BUILD_TEST=1" >> config.mk
    make all
fi

if [[ ${TASK} == "cmake_test" ]]; then
    # Build dmlc-core with CMake, including unit tests
    rm -rf build
    mkdir build && cd build
    cmake .. -GNinja -DGOOGLE_TEST=ON -DUSE_PARQUET=ON -DParquet_DIR=$CONDA_PREFIX/lib/cmake/arrow -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror"
    ninja -v
    ./test/unittest/dmlc_unit_tests
fi

if [[ ${TASK} == "sanitizer_test" ]]; then
    rm -rf build
    mkdir build && cd build
    cmake .. -GNinja -DGOOGLE_TEST=ON -DDMLC_USE_SANITIZER=ON -DUSE_PARQUET=ON \
             -DParquet_DIR=$CONDA_PREFIX/lib/cmake/arrow \
             -DDMLC_ENABLED_SANITIZERS="thread" -DCMAKE_BUILD_TYPE=Debug ..
    ninja
    ./test/unittest/dmlc_unit_tests || true   # For now just display sanitizer errors
    rm -rf *
    cmake .. -GNinja -DGOOGLE_TEST=ON -DDMLC_USE_SANITIZER=ON -DUSE_PARQUET=ON \
             -DParquet_DIR=$CONDA_PREFIX/lib/cmake/arrow \
             -DDMLC_ENABLED_SANITIZERS="leak;address" -DCMAKE_BUILD_TYPE=Debug ..
    ninja
    ./test/unittest/dmlc_unit_tests || true   # For now just display sanitizer errors
fi

if [[ ${TASK} == "s390x_test" ]]; then
    # Run unit tests inside emulated s390x Docker container (uses QEMU transparently).
    # This should help us achieve compatibility with big endian targets.
    scripts/s390x/ci_build.sh s390_container scripts/s390x/build_via_cmake.sh
    scripts/s390x/ci_build.sh s390_container -e DMLC_UNIT_TEST_LITTLE_ENDIAN=0 build/test/unittest/dmlc_unit_tests
fi