forked from CyberSource/cybersource-rest-samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_code_runner.sh
27 lines (23 loc) · 873 Bytes
/
sample_code_runner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
FILECOUNT=0
SAMPLECOUNT=1
find samples -print | grep -i -e "\.py$" > list.txt
echo > output.log
set -e
while IFS="" read -r p || [ -n "$p" ]
do
if [[ "$p" =~ $(echo ^\($(sed 's/[[:blank:]]//g' sampleCodeIgnoreList.txt | paste -sd '|' /dev/stdin)\)$) ]]; then
printf '\n\n#### SKIPPED - %s ####\n' "$p"
printf '\n\n#### SKIPPED - %s ####\n' "$p" >> output.log
else
printf '\n\n**** RUNNING - %s ****\n' "$p"
printf '\n\n%s **** RUNNING - %s ****\n' "$SAMPLECOUNT" "$p" >> output.log
python "$p" >> output.log
printf '\n\n**** END RUNNING - %s ****\n' "$p" >> output.log
SAMPLECOUNT=$((SAMPLECOUNT+1))
fi
FILECOUNT=$((FILECOUNT+1))
done < list.txt
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$SAMPLECOUNT"
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$FILECOUNT" >> output.log
rm -f list.txt