Skip to content

Commit

Permalink
[tests] add test script to run tools with -d
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchini committed Apr 26, 2019
1 parent ad753d5 commit 4ff113d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Expand Up @@ -102,3 +102,7 @@ foreach(testprog ${testprogs})
add_executable (${bin_name} ${testprog})
set_target_properties( ${bin_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testprogs/ )
endforeach()

configure_file(tools-parsing-test.sh tools-parsing-test.sh COPYONLY)
add_custom_target(tools-parsing-test COMMAND ./tools-parsing-test.sh)
add_test(NAME tools-parsing-test COMMAND ./tools-parsing-test.sh)
22 changes: 22 additions & 0 deletions tests/tools-parsing-test.sh
@@ -0,0 +1,22 @@
#!/bin/bash

set +e;

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

BPFTRACE_EXECUTABLE=${BPFTRACE_EXECUTABLE:-$DIR/../src/bpftrace};

EXIT_STATUS=0;

# TODO(mmarchini) get path from cmake
for f in $(ls ../../tools/*.bt); do
if $BPFTRACE_EXECUTABLE -d $f 2>/dev/null >/dev/null; then
echo "$f passed"
else
echo "$f failed";
$BPFTRACE_EXECUTABLE -d $f;
EXIT_STATUS=1;
fi
done

exit $EXIT_STATUS

0 comments on commit 4ff113d

Please sign in to comment.