vfs: check userland buffers before reading them.
[haiku.git] / src / tests / system / runtime_loader / test_suite / test_setup
blobd8e0d70f94ea4c175582c46bc903d917497ea3e2
2 os=$(uname)
4 case $os in
5         FreeBSD)        libdl=;;
6         Linux)          libdl=-ldl;;
7         Haiku)          libdl=;;
8         *)                      echo "Unsupported OS: $os"; exit 1;;
9 esac
11 testdir=${testdir-testdir}/$(basename $0)
13 rm -rf $testdir
14 mkdir -p $testdir
15 cd $testdir
17 # test_run_ok <program> <expected return value>
18 test_run_ok()
20         # exists?
21         if [ ! -f $1 ]; then
22                 exit 1
23         fi
25         # run
26         $1
27         retval=$?
28         if [ $retval != $2 ]; then
29                 echo "test_run_ok: $1: return value: $retval, expected: $2"
30                 exit 1
31         fi
34 compile_lib()
36         gcc -shared $@ -D_GNU_SOURCE -fPIC
39 compile_lib_dl()
41         compile_lib $@ $libdl
44 compile_program()
46         gcc $@ -D_GNU_SOURCE -Wl,-rpath,.,--export-dynamic
49 compile_program_dl()
51         compile_program $@ $libdl