tests: use most recent nitc if not supplied
authorJean-Sebastien Gelinas <calestar@gmail.com>
Fri, 24 Jul 2009 16:50:43 +0000 (12:50 -0400)
committerJean Privat <jean@pryen.org>
Tue, 28 Jul 2009 13:38:30 +0000 (09:38 -0400)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

tests/tests.sh

index 4314ea9..5b32a7d 100755 (executable)
@@ -20,9 +20,6 @@
 # Set lang do default to avoid failed tests because of locale
 export LANG=C
 
-# The default nitc compiler
-[ -z "$NITC" ] && NITC=../bin/nitc
-
 usage()
 {
        e=`basename "$0"`
@@ -81,6 +78,19 @@ function process_result()
        fi
 }
 
+find_nitc()
+{
+       recent=`ls -t ../src/nitc ../src/nitc_[0-9] ../bin/nitc ../c_src/nitc 2>/dev/null | head -1`
+       if [[ "x$recent" == "x" ]]; then
+               echo 'Could not find nitc, aborting'
+               exit 1
+       fi
+       echo 'Using nitc from: '$recent
+       NITC=$recent
+}
+
+# The default nitc compiler
+[ -z "$NITC" ] && find_nitc
 
 verbose=false
 stop=false