File: run_scripts_quiet.sh

package info (click to toggle)
gretl 2025b-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,984 kB
  • sloc: ansic: 426,435; sh: 4,916; makefile: 3,257; cpp: 2,777; xml: 610; perl: 364
file content (73 lines) | stat: -rwxr-xr-x 1,911 bytes parent folder | download | duplicates (3)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash

if [ "x$1" != "x" ] ; then
   # executing in build tree
   INPPATH=$1
   GRETLCLI="$(pwd)/../cli/gretlcli"
else
   # executing "here" using installed gretlcli
   INPPATH="."
   GRETLCLI="gretlcli"
fi

# Remove the 'fails' file if it exists
rm -f fails

# Store the current directory path
HERE=`pwd`

# Initialize exit status variable
my_status=0

# Test scripts in the 'practice_scripts' directory
echo "*** practice scripts ***"
for f in `find $INPPATH/practice_scripts -name "*.inp"` ; do
   # Print the name of the script being tested
   bname=`basename $f`
   echo -n $bname

   # Run the script with gretlcli in batch and quiet mode
   ${GRETLCLI} -b -q -e $f > /dev/null 2>&1

   # Check if the script failed
   if [ $? != 0 ] ; then
      # Print 'Failed', update status variable, and log the failed script
      echo -e " [\e[0;31mFailed\e[0m]"
      my_status=1
      echo $INPPATH/practice_scripts/$bname >> $HERE/fails
   else
      # Print 'OK' if the script succeeded
      echo -e " [\e[0;32mOK\e[0m]"
   fi
done

# Test scripts in the 'commands', 'functions', and 'fundamentals' directories
for d in commands functions fundamentals ; do
   echo "*** $d ***"
   cd $INPPATH/test_scripts/$d
   for f in `find . -name "*.inp"` ; do
      bname=`basename $f`
      echo -n $bname
      ${GRETLCLI} -b -q -e $f > /dev/null 2>&1
      if [ $? != 0 ] ; then
           echo -e " [\e[0;31mFailed\e[0m]"
           my_status=1
           echo $INPPATH/test_scripts/$d/$bname >> $HERE/fails
      else
           echo -e " [\e[0;32mOK\e[0m]"
      fi
   done
   # Return to the original directory
   cd $HERE
done

# If there were any failures, print the names of the failed scripts
if test -f fails ; then
   echo -e "\e[0;31mFailed script(s):\e[0m"
   cat fails
else
   echo "No errors were found"
fi

# Exit with status code 0 if all scripts passed, 1 if any script failed.
exit $my_status