#!/bin/sh

PTEST_PATH=$(dirname "$0")
cd "$PTEST_PATH/tests" || exit 1

export UST_TESTS_SRCDIR="$PTEST_PATH/tests"
export UST_TESTS_BUILDDIR="$PTEST_PATH/tests"

TESTS="
unit/libringbuffer/test_shm
unit/gcc-weak-hidden/test_gcc_weak_hidden
unit/libcommon/test_get_cpu_mask_from_sysfs
unit/libcommon/test_get_max_cpuid_from_mask
unit/libcommon/test_get_max_cpuid_from_sysfs
unit/libcommon/test_get_possible_cpus_array_len
unit/libmsgpack/test_msgpack
unit/pthread_name/test_pthread_name
unit/snprintf/test_snprintf
unit/ust-elf/test_ust_elf
unit/ust-error/test_ust_error
unit/ust-utils/test_ust_utils
"

for test in $TESTS; do
    [ -x "$test" ] || continue
    if ( cd "$(dirname "$test")" && ./"$(basename "$test")" ); then
        echo "PASS: $test"
    else
        echo "FAIL: $test"
    fi
done
