thorvg/examples/all.sh
Hermet Park e8e9ba5ea0 infra: move the examples folder outside of the source directory.
examples are not considered a feature of ThorVG;
hence, they are excluded from the src directory.

This change allows developers to concentrate more effectively
on the core ThorVG sources for practical usages.
2024-04-01 10:52:22 +09:00

29 lines
563 B
Bash
Executable file

#!/bin/bash
RED='\033[31m'
GREEN='\033[32m'
NC='\033[0m'
INTERVAL=${1:-2}
CHECK_OS="`uname -s`"
if [[ "$CHECK_OS" = "Darwin"* ]]; then
EXAMPLES=`find . -perm +111 -type f | sort | uniq`
else
EXAMPLES=`find . -executable -type f | sort | uniq`
fi
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