tests: bt2: add `--test-case` argument to testrunner.py
[babeltrace.git] / tests / utils / utils.sh
index c44e2e3ba12833e94789ab1be99831ab5b04d9bd..5b9f0e96d17d9ab31ccdc647da4cb3ddceb6b70d 100644 (file)
@@ -45,11 +45,17 @@ fi
 # Allow overriding the babeltrace2 executables
 if [ "x${BT_TESTS_BT2_BIN:-}" = "x" ]; then
        BT_TESTS_BT2_BIN="$BT_TESTS_BUILDDIR/../src/cli/babeltrace2"
+       if [ "x${MSYSTEM:-}" != "x" ]; then
+               BT_TESTS_BT2_BIN="${BT_TESTS_BT2_BIN}.exe"
+       fi
 fi
 export BT_TESTS_BT2_BIN
 
 if [ "x${BT_TESTS_BT2LOG_BIN:-}" = "x" ]; then
        BT_TESTS_BT2LOG_BIN="$BT_TESTS_BUILDDIR/../src/cli/babeltrace2-log"
+       if [ "x${MSYSTEM:-}" != "x" ]; then
+               BT_TESTS_BT2LOG_BIN="${BT_TESTS_BT2LOG_BIN}.exe"
+       fi
 fi
 export BT_TESTS_BT2LOG_BIN
 
@@ -121,7 +127,7 @@ bt_diff_cli() {
        echo "$args" | xargs "$BT_TESTS_BT2_BIN" 2>/dev/null | tr -d "\r" > "$temp_output_file"
 
        # Compare output with expected output
-       if ! diff "$temp_output_file" "$expected_file" 2>/dev/null >"$temp_diff"; then
+       if ! diff -u "$temp_output_file" "$expected_file" 2>/dev/null >"$temp_diff"; then
                echo "ERROR: for '$args': actual and expected outputs differ:" >&2
                cat "$temp_diff" >&2
                ret=1
@@ -194,16 +200,16 @@ run_python_bt2() {
        local lib_search_var
        local lib_search_path
 
+       local python_provider_path="${BT_TESTS_BUILDDIR}/../src/python-plugin-provider/.libs"
+       local main_lib_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs"
+
        # Set the library search path so the python interpreter can load libbabeltrace2
        if [ "x${MSYSTEM:-}" != "x" ]; then
                lib_search_var="PATH"
-               lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${PATH:-}"
+               lib_search_path="${python_provider_path}:${main_lib_path}:${PATH:-}"
        else
                lib_search_var="LD_LIBRARY_PATH"
-               lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${LD_LIBRARY_PATH:-}"
-       fi
-       if [ "x${test_lib_search_path:-}" != "x" ]; then
-               lib_search_path+=":${test_lib_search_path}"
+               lib_search_path="${python_provider_path}:${main_lib_path}:${LD_LIBRARY_PATH:-}"
        fi
 
        env \
@@ -220,11 +226,9 @@ run_python_bt2() {
 #
 # $1 : The directory containing the python test scripts
 # $2 : The pattern to match python test script names (optional)
-# $3 : Additionnal library search path (optional)
 run_python_bt2_test() {
        local test_dir="$1"
-       local test_pattern="${2:-}" # optional
-       local test_lib_search_path="${3:-}" # optional
+       local test_pattern="${2:-'*'}" # optional, if none default to "*"
 
        local ret
        local test_runner_args=()
@@ -243,7 +247,9 @@ run_python_bt2_test() {
        run_python_bt2 \
                "${python_exec}" \
                "${BT_TESTS_SRCDIR}/utils/python/testrunner.py" \
-               "${test_runner_args[@]}"
+               --pattern "$test_pattern" \
+               "$test_dir" \
+
        ret=$?
 
        if test "x${BT_TESTS_COVERAGE_REPORT:-}" = "x1"; then
This page took 0.026348 seconds and 4 git commands to generate.