|
1 |
| -#!/system/bin/sh |
2 |
| - |
3 |
| -if [ -z "$1" ]; then |
4 |
| - echo "Usage: $0 <sub-directory>" |
5 |
| - exit 1 |
6 |
| -fi |
7 |
| - |
8 |
| -SUB_DIR=$1 |
9 |
| -if [ ! -d "$SUB_DIR" ]; then |
10 |
| - echo "Error: Directory $SUB_DIR does not exist" |
11 |
| - exit 1 |
12 |
| -fi |
13 |
| - |
14 |
| -CTEST_FILE="$SUB_DIR/CTestTestfile.cmake" |
15 |
| -if [ ! -f "$CTEST_FILE" ]; then |
16 |
| - echo "Error: $CTEST_FILE not found in $SUB_DIR" |
17 |
| - exit 1 |
18 |
| -fi |
19 |
| - |
20 |
| -# TODO: Parse them from CTEST_FILE |
21 |
| -TESTS="dispatch_apply dispatch_api dispatch_debug dispatch_queue_finalizer dispatch_overcommit dispatch_context_for_key dispatch_after dispatch_timer dispatch_timer_short dispatch_timer_timeout dispatch_sema dispatch_timer_bit31 dispatch_timer_bit63 dispatch_timer_set_time dispatch_data dispatch_io_muxed dispatch_io_net dispatch_io_pipe dispatch_io_pipe_close dispatch_select dispatch_c99 dispatch_plusplus" |
22 |
| - |
23 |
| -COUNT=$(echo "$TESTS" | tr ' ' '\n' | wc -l) |
24 |
| -echo "Found $COUNT test-cases in $SUB_DIR" |
25 |
| - |
26 |
| -UTILITY="$SUB_DIR/bsdtestharness" |
27 |
| -if [ ! -f "$UTILITY" ]; then |
28 |
| - echo "Utility not found: $UTILITY." |
29 |
| - exit 1 |
30 |
| -fi |
31 |
| - |
32 |
| -chmod +x "$UTILITY" |
33 |
| - |
34 |
| -# We need libdispatch.so and libBlocksRuntime.so |
35 |
| -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUB_DIR" |
36 |
| - |
37 |
| -# TODO: Parse the timeout as well from CTestTestfile.cmake? |
38 |
| -TIMOUT=120 |
39 |
| -FAILURE=0 |
40 |
| - |
41 |
| -for TEST in $TESTS; do |
42 |
| - chmod +x "$SUB_DIR/$TEST" |
43 |
| - OUTPUT=$(timeout "${TIMOUT}s" "$UTILITY" "$SUB_DIR/$TEST" 2>&1) |
44 |
| - EC=$? |
45 |
| - if [ $EC -eq 124 ]; then |
46 |
| - echo "Error: $TEST timed out after $TIMOUT seconds" |
47 |
| - echo "************\nOutput:\n$OUTPUT\n************" |
48 |
| - FAILURE=1 |
49 |
| - elif [ $EC -ne 0 ]; then |
50 |
| - echo "Error: $TEST failed" |
51 |
| - echo "************\nOutput:\n$OUTPUT\n************" |
52 |
| - FAILURE=1 |
53 |
| - else |
54 |
| - echo "$TEST passed" |
55 |
| - fi |
56 |
| -done |
57 |
| - |
58 |
| -exit $FAILURE |
| 1 | +#!/system/bin/sh |
| 2 | + |
| 3 | +if [ -z "$1" ]; then |
| 4 | + echo "Usage: $0 <sub-directory>" |
| 5 | + exit 1 |
| 6 | +fi |
| 7 | + |
| 8 | +SUB_DIR=$1 |
| 9 | +if [ ! -d "$SUB_DIR" ]; then |
| 10 | + echo "Error: Directory $SUB_DIR does not exist" |
| 11 | + exit 1 |
| 12 | +fi |
| 13 | + |
| 14 | +CTEST_FILE="$SUB_DIR/CTestTestfile.cmake" |
| 15 | +if [ ! -f "$CTEST_FILE" ]; then |
| 16 | + echo "Error: $CTEST_FILE not found in $SUB_DIR" |
| 17 | + exit 1 |
| 18 | +fi |
| 19 | + |
| 20 | +# TODO: Parse them from CTEST_FILE |
| 21 | +TESTS="dispatch_apply dispatch_api dispatch_debug dispatch_queue_finalizer dispatch_overcommit dispatch_context_for_key dispatch_after dispatch_timer dispatch_timer_short dispatch_timer_timeout dispatch_sema dispatch_timer_bit31 dispatch_timer_bit63 dispatch_timer_set_time dispatch_data dispatch_io_muxed dispatch_io_net dispatch_io_pipe dispatch_io_pipe_close dispatch_select dispatch_c99 dispatch_plusplus" |
| 22 | + |
| 23 | +COUNT=$(echo "$TESTS" | tr ' ' '\n' | wc -l) |
| 24 | +echo "Found $COUNT test-cases in $SUB_DIR" |
| 25 | + |
| 26 | +UTILITY="$SUB_DIR/bsdtestharness" |
| 27 | +if [ ! -f "$UTILITY" ]; then |
| 28 | + echo "Utility not found: $UTILITY." |
| 29 | + exit 1 |
| 30 | +fi |
| 31 | + |
| 32 | +chmod +x "$UTILITY" |
| 33 | + |
| 34 | +# We need libdispatch.so and libBlocksRuntime.so |
| 35 | +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUB_DIR" |
| 36 | + |
| 37 | +# TODO: Parse the timeout as well from CTestTestfile.cmake? |
| 38 | +TIMOUT=120 |
| 39 | +FAILURE=0 |
| 40 | + |
| 41 | +for TEST in $TESTS; do |
| 42 | + chmod +x "$SUB_DIR/$TEST" |
| 43 | + OUTPUT=$(timeout "${TIMOUT}s" "$UTILITY" "$SUB_DIR/$TEST" 2>&1) |
| 44 | + EC=$? |
| 45 | + if [ $EC -eq 124 ]; then |
| 46 | + echo "Error: $TEST timed out after $TIMOUT seconds" |
| 47 | + echo "************\nOutput:\n$OUTPUT\n************" |
| 48 | + FAILURE=1 |
| 49 | + elif [ $EC -ne 0 ]; then |
| 50 | + echo "Error: $TEST failed" |
| 51 | + echo "************\nOutput:\n$OUTPUT\n************" |
| 52 | + FAILURE=1 |
| 53 | + else |
| 54 | + echo "$TEST passed" |
| 55 | + fi |
| 56 | +done |
| 57 | + |
| 58 | +exit $FAILURE |
0 commit comments