Merge: src/platforms: fallback to version field "0" on error when asking for a git_re...
[nit.git] / contrib / nitester / src / nitester.nit
index 3431a86..0904053 100644 (file)
@@ -77,7 +77,7 @@ abstract class Processor
        var engines: Array[String] is noinit
 
        # All known engines, used to detect errors in `engines`
-       var all_engines: Array[String] = ["nitg-s", "nitg-sg", "nitg-g", "nitg-e", "niti", "emscripten"]
+       var all_engines: Array[String] = ["nitcs", "nitcsg", "nitcg", "nitce", "niti", "emscripten"]
 
        # Programs to test in this execution
        var test_programs: Array[String] is noinit
@@ -131,7 +131,6 @@ abstract class Processor
                                else
                                        full_path.file_delete
                                end
-                               stat.free
                        end
                        mpi.finalize
                        exit 0
@@ -150,7 +149,7 @@ abstract class Processor
                var engines
                if engines_str == null then
                        # default
-                       engines = ["nitg-s"]
+                       engines = ["nitcs"]
                else
                        engines = engines_str.split(',')
 
@@ -171,7 +170,7 @@ abstract class Processor
        end
 
        # All tasks to be performed
-       var tasks = new Array[Task]
+       var tasks = new Array[TesterTask]
 
        # Gather and register all tasks
        fun create_tasks
@@ -180,22 +179,21 @@ abstract class Processor
                var skip_path = "tests/turing.skip"
                var skip
                if skip_path.file_exists then
-                       var skip_file = new IFStream.open(skip_path)
+                       var skip_file = new FileReader.open(skip_path)
                        skip = skip_file.read_lines
                        skip_file.close
                else
                        skip = new Array[String]
                end
 
-               for prog in test_programs do for engine in engines do
-
+               for engine in engines do for prog in test_programs do
                        # Is is blacklisted?
                        for s in skip do if not s.is_empty and prog.has(s) then
                                if verbose > 0 and rank == 0 then print "Skipping test '{prog}' because of '{s}' in turing.skip"
                                continue label
                        end
 
-                       tasks.add new Task(engine, prog)
+                       tasks.add new TesterTask(engine, prog)
                end label
        end
 end
@@ -303,7 +301,7 @@ class Controller
                                mpi.recv_empty(status.source, status.tag, comm_world)
                                at_work.remove(status.source)
 
-                               if verbose > 1 then print "worker {status.source} is done ({at_work.length} still at work)"
+                               if verbose > 0 then print "Worker {status.source} is done ({at_work.length} still at work)"
                        else
                                print "Unexpected tag {status.tag}"
                                shutdown
@@ -405,9 +403,8 @@ class Worker
                exec_and_check "git config remote.origin.fetch +refs/remotes/origin/pr/*:refs/remotes/origin/pr/*"
                exec_and_check "git fetch origin --quiet"
                exec_and_check "git checkout {branch_hash}"
-               exec_and_check "cp {remote_nit}/bin/nitg bin/"
+               exec_and_check "cp {remote_nit}/bin/*  bin/"
                exec_and_check "src/git-gen-version.sh"
-               exec_and_check "bin/nitg --dir bin/ src/nit.nit src/nitvm.nit"
        end
 
        private fun exec_and_check(cmd: String)
@@ -432,7 +429,7 @@ class Worker
        # Single C `int` to hold the next task id received from the `Controller`
        var task_buffer = new CIntArray(1)
 
-       # Manage communication with the `Controller` and execute dispatched `Task`s
+       # Manage communication with the `Controller` and execute dispatched `TesterTask`s
        fun work_on_tasks
        do
                var status = new Status
@@ -465,7 +462,7 @@ class Worker
                                        sys.system cmd
 
                                        # Test results were written to file, read them
-                                       var fstream = new IFStream.open(tests_sh_out)
+                                       var fstream = new FileReader.open(tests_sh_out)
                                        var content = fstream.read_all
                                        fstream.close
 
@@ -520,6 +517,8 @@ class Worker
                                                end
                                        end
 
+                                       if verbose > 1 then print "Done testing: {task}"
+
                                        self.results_count = c
                                end
 
@@ -549,7 +548,7 @@ class Worker
        fun send_results
        do
                if results_count > 0 then
-                       if verbose > 1 then print "sending {results_count} results"
+                       if verbose > 2 then print "Sending {results_count} results"
                        mpi.send_from(buffer, 0, results_count*4, controller_rank, result_tag, comm_world)
                        results_count = 0
                end
@@ -567,7 +566,7 @@ end
 #
 # Note that a task may involve more than one program to test considering the
 # alts and args for the `test_program`.
-class Task
+class TesterTask
        # Engine to test executing `test_program`
        var engine: String
 
@@ -577,12 +576,12 @@ class Task
        redef fun to_s do return "{engine} {test_program}"
 end
 
-# Result of a `Task`
+# Result of a `TesterTask`
 #
-# There may be more than one result per `Task`.
+# There may be more than one result per `TesterTask`.
 class Result
-       # `Task` associated to `self`
-       var task: Task
+       # `TesterTask` associated to `self`
+       var task: TesterTask
 
        # Argument index of the execution resulting in `self`
        var arg: Int