example: add script to execute all

This patch will save your time to check example.

  ./all.sh [interval time between examples, default is 1 second]
This commit is contained in:
Shinwoo Kim 2021-12-22 02:14:19 +09:00 committed by Hermet Park
parent 100d98d82e
commit d349f73222
2 changed files with 26 additions and 0 deletions

22
src/examples/all.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
RED='\033[31m'
GREEN='\033[32m'
NC='\033[0m'
INTERVAL=${1:-1}
EXAMPLES=`find . -executable -type f | sort | uniq`
for EXAMPLE in $EXAMPLES
do
if [[ $EXAMPLE == *.sh ]]; then
continue
fi
echo -e "Execute: "${GREEN}$EXAMPLE${NC}" for "$INTERVAL" second(s)"
$EXAMPLE &
EXAMPLE_PID=$!
sleep $INTERVAL
kill -s SIGTERM $EXAMPLE_PID
if [ $? -ne 0 ]; then
echo -e "Something wrong with: "${RED}$EXAMPLE${NC}
fi
done

View file

@ -67,3 +67,7 @@ if get_option('bindings').contains('capi') == true
dependencies : examples_dep)
endforeach
endif
execute_all_src = join_paths(meson.source_root(), 'src/examples/all.sh')
execute_all_dest = join_paths(meson.build_root(), 'src/examples/all.sh')
run_command('cp', execute_all_src, execute_all_dest)