source: rtems/tools/build/rtems-test-check @ 258bda3

Last change on this file since 258bda3 was 258bda3, checked in by Chris Johns <chrisj@…>, on Apr 3, 2017 at 10:11:24 PM

testsuite: Add a common test configuration. Fix configure.ac and Makefile.am errors.

  • Add a top level test configuration file for test states that are common to all BSPs. This saves adding a test configuration (tcfg) file for every BSP.
  • Add the test states 'user-input' and 'benchmark'. This lets 'rtems-test' stop the test rather than waiting for a timeout or letting a benchmark run without the user asking for it to run.
  • Implement rtems-test-check in Python to make it faster. The shell script had grown to a point it was noticably slowing the build down.
  • Fix the configure.ac and Makefile.am files for a number of the test directories. The files are difficiult to keep in sync with the number of tests and mistakes can happen such as tests being left out of the build. The test fsrofs01 is an example. Also a there was a mix of SUBDIRS and _SUBDIRS being used and only _SUBDIRS should be used.
  • Fix the test fsrofs01 so it compiles.

Closes #2963.

  • Property mode set to 100755
File size: 4.5 KB
Line 
1#! /bin/sh
2#
3# Copyright 2014, 2016, 2017 Chris Johns <chrisj@rtems.org>
4# All rights reserved
5#
6
7#
8# usage: rtems-test-check <mode> <bsp-test-database> <includes> <bsp> <tests..>
9#
10
11if test $# -lt 4; then
12  echo "error: invalid command line" >&2
13  echo "INVALID-TEST-DATA"
14  exit 2
15fi
16
17mode="$1"
18shift
19testdata="$1"
20shift
21includepath="$1"
22shift
23bsp="$1"
24shift
25tests="$*"
26
27test_count=0
28for t in ${tests};
29do
30 test_count=$(expr ${test_count} + 1)
31done
32
33case ${mode} in
34 exclude)
35   if test -f $testdata; then
36     output=""
37   else
38     output="${tests}"
39   fi
40   ;;
41 flags)
42   if [ $test_count != 1 ]; then
43     echo "error: test count not 1 for ${mode}" 1>&2
44     exit 1
45   fi
46   output=""
47   ;;
48 *)
49   echo "error: invalid mode" 1>&2
50   echo "INVALID-TEST-DATA"
51   exit 1
52   ;;
53esac
54
55#
56# Read the common settings first.
57#
58if [ -f $includepath/testdata/rtems.tcfg ]; then
59 testdata="$includepath/testdata/rtems.tcfg $testdata"
60fi
61
62#
63# If there is no testdata all tests are valid and must pass.
64#
65
66if [ ! -z "$testdata" ]; then
67  excluded_tests=""
68  expected_fails=""
69  user_inputs=""
70  indeterminates=""
71  benchmarks=""
72  while [ ! -z "$testdata" ];
73  do
74    for td in $testdata;
75    do
76      if [ ! -f $td ]; then
77        continue
78      fi
79      ntd=""
80      exec 3<& 0
81      exec 0<$td
82      while read line
83      do
84        line=$(echo $line | sed -e 's/#.*$//' -e '/^$/d')
85        if [ ! -z "$line" ]; then
86          state=$(echo $line | sed -e "s/:.*//g")
87          case $state in
88            include)
89              inf=$(echo $line | sed -e 's/include://g;s/[[:blank:]]//g')
90              if test -f $includepath/$inf; then
91                ntd="$includepath/$inf $ntd"
92              fi
93              ;;
94            exclude)
95              line=$(echo $line | sed -e 's/exclude://g;s/[[:blank:]]//g')
96              excluded_tests="${excluded_tests} $line"
97              ;;
98            expected-fail)
99              line=$(echo $line | sed -e 's/expected-fail://g;s/[[:blank:]]//g')
100              expected_fails="${expected_fails} $line"
101              ;;
102            user-input)
103              line=$(echo $line | sed -e 's/user-input://g;s/[[:blank:]]//g')
104              user_inputs="${user_inputs} $line"
105              ;;
106            indeterminate)
107              line=$(echo $line | sed -e 's/indeterminate://g;s/[[:blank:]]//g')
108              indeterminates="${indeterminates} $line"
109              ;;
110            benchmark)
111              line=$(echo $line | sed -e 's/benchmark://g;s/[[:blank:]]//g')
112              benchmarks="${benchmarks} $line"
113              ;;
114            *)
115              echo "error: invalid test state: $state in $td" 1>&2
116              echo "INVALID-TEST-DATA"
117              exit 1
118              ;;
119          esac
120        fi
121      done
122    done
123    testdata=$ntd
124  done
125
126  for t in ${tests};
127  do
128    case ${mode} in
129      exclude)
130        allow="yes"
131        for dt in ${excluded_tests};
132        do
133          if test ${t} = ${dt}; then
134            allow="no"
135          fi
136        done
137        if test ${allow} = yes; then
138          output="${output} ${t}"
139        fi
140        ;;
141      flags)
142        allow="yes"
143        for et in ${excluded_tests};
144        do
145          if test ${t} = ${et}; then
146            allow="no"
147          fi
148        done
149        if test ${allow} = yes; then
150          allow="no"
151          for et in ${expected_fails};
152          do
153            if test ${t} = ${et}; then
154              allow="yes"
155            fi
156          done
157          if test ${allow} = yes; then
158            output="-DTEST_STATE_EXPECTED_FAIL=1"
159          fi
160          allow="no"
161          for ut in ${user_inputs};
162          do
163            if test ${t} = ${ut}; then
164              allow="yes"
165            fi
166          done
167          if test ${allow} = yes; then
168            output="-DTEST_STATE_USER_INPUT=1"
169          fi
170          allow="no"
171          for it in ${indeterminates};
172          do
173            if test ${t} = ${it}; then
174              allow="yes"
175            fi
176          done
177          if test ${allow} = yes; then
178            output="${output} -DTEST_STATE_INDETERMINATE=1"
179          fi
180          allow="no"
181          for bt in ${benchmarks};
182          do
183            if test ${t} = ${bt}; then
184              allow="yes"
185            fi
186          done
187          if test ${allow} = yes; then
188            output="${output} -DTEST_STATE_BENCHMARK=1"
189          fi
190        fi
191        ;;
192      *)
193        echo "error: invalid mode" 1>&2
194        echo "INVALID-TEST-DATA"
195        exit 1
196        ;;
197    esac
198  done
199fi
200
201echo ${output}
202
203exit 0
Note: See TracBrowser for help on using the repository browser.