diff --git a/src/examples/all.sh b/src/examples/all.sh new file mode 100755 index 00000000..fc1d2bcc --- /dev/null +++ b/src/examples/all.sh @@ -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 diff --git a/src/examples/meson.build b/src/examples/meson.build index 31331c8f..75feb43d 100644 --- a/src/examples/meson.build +++ b/src/examples/meson.build @@ -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)