2 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 while [ "$stop" = false
]; do
19 -v
) verbose
=true
; shift;;
25 echo "Usage: search_test.sh [-v] prog/res/testname..."
26 echo "Search program paths of tests for given nit files, res files, and test names"
27 echo " -v Try to find something and display it when a test is not found."
33 # Build the full list once to filter results
34 .
/listfull.sh
> listfull.out
35 find zzz_tests
>> listfull.out
41 if test -f
"$ff"; then
45 b
=`basename -- "$f" .nit`
48 b
=`basename -- "$f" .res`
55 c
=`echo "$b" | sed 's/\([\\.*^$]\|\[\|]\)/./g'`
56 # Remove alts of args test variations
57 c
=`echo "$c" | sed 's/\(_[0-9]*alt[0-9][0-9]*\)/\\\\(\1\\\\)\\\\?/g;s/\(_args[0-9][0-9]*\)/\\\\(\1\\\\)\\\\?/'`
58 b
=`echo "$b" | sed 's/_[0-9]*alt[0-9][0-9]*//g;s/_args[0-9][0-9]*//'`
59 # Search the orig nit file in the list
60 cat listfull.out |
grep -- "\(^\|/\)$c.nit" ||
{
62 echo >&2 "No test $b.nit found for $f"
63 test "$verbose" == "true" ||
continue
64 # Search the nit file outside the list...
65 find ..
/..
/nit
* -name
"$b.nit" >&2
66 # Search the nit file in the git history...
67 git log
-1 -- "$b.nit" >&2
68 # Search the orig file in the git history...
69 git log
-1 -- "$f" >&2