Merge: Less old style init special cases
authorJean Privat <jean@pryen.org>
Mon, 29 Sep 2014 17:07:35 +0000 (13:07 -0400)
committerJean Privat <jean@pryen.org>
Mon, 29 Sep 2014 17:07:35 +0000 (13:07 -0400)
The general transition to new constructor is nearer each day.

May fix an issue informally signaled by @R4PaSs.

Pull-Request: #783
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

34 files changed:
misc/jenkins/checklicense.sh [new file with mode: 0755]
misc/jenkins/unitrun.sh
src/testing/testing_doc.nit
src/testing/testing_suite.nit
tests/listfull.sh
tests/puzzle.args [new file with mode: 0644]
tests/sav/array_debug.res [deleted file]
tests/sav/friendz_linux.res [deleted file]
tests/sav/hash_debug.res [deleted file]
tests/sav/javap_visitor.res [deleted file]
tests/sav/jwrapper.res [deleted file]
tests/sav/linux_app.res [deleted file]
tests/sav/linux_assets.res [deleted file]
tests/sav/mnit_linux.res [deleted file]
tests/sav/mnit_null.res [deleted file]
tests/sav/nitcc.res [deleted file]
tests/sav/nitcc_lexer0.res [deleted file]
tests/sav/nitcc_parser_gen.res [deleted file]
tests/sav/nitcc_semantic.res [deleted file]
tests/sav/nitg-e/fixme/pnacl.res [deleted file]
tests/sav/nitg-g/fixme/pnacl.res [deleted file]
tests/sav/nitg-s/fixme/pnacl.res [deleted file]
tests/sav/nitg-s/fixme/sensors.res [deleted file]
tests/sav/nitg-sg/fixme/pnacl.res [deleted file]
tests/sav/nitg-sg/fixme/sensors.res [deleted file]
tests/sav/niti/mnit_injected_input.res [deleted file]
tests/sav/nitmd.res [deleted file]
tests/sav/nitunit_args1.res
tests/sav/puzzle_args1.res [new file with mode: 0644]
tests/sav/re2nfa.res [deleted file]
tests/sav/sort_downloads.res [deleted file]
tests/sav/svg_to_icons.res [deleted file]
tests/sav/svg_to_png_and_nit.res [deleted file]
tests/tests.sh

diff --git a/misc/jenkins/checklicense.sh b/misc/jenkins/checklicense.sh
new file mode 100755 (executable)
index 0000000..3a28ae4
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Check missing signed-off-by in commits
+
+if test "$#" -lt 2; then
+       echo "Usage: checklicense from to"
+       echo ""
+       exit
+fi
+
+from=$1
+to=$2
+
+err=0
+
+git diff --name-status $from..$to -- "*.nit" "*.sh" | sed -n 's/^A\s*//p' > checklicense_new_files.out
+test -s checklicense_new_files.out || exit 0
+grep -L 'his file is part of NIT' `cat checklicense_new_files.out` 2>/dev/null | tee checklicense_missing.out
+test \! -s checklicense_missing.out
index c652286..54d875c 100755 (executable)
@@ -26,12 +26,15 @@ shift
 
 # Magic here! This tee and save both stdout and stderr in distinct files without messing with them
 # Time  just get the user time
-/usr/bin/time -f%U -o "${name}.t.out" "$@" > >(tee "${name}.out") 2> >(tee "${name}.2.out" >&2)
+/usr/bin/time -f%U --quiet -o "${name}.t.out" "$@" > >(tee "${name}.out") 2> >(tee "${name}.2.out" >&2)
 res=$?
 
+c=`echo "${name%-*}" | tr "-" "."`
+n=${name##*-}
+
 cat > "${name}.xml"<<END
 <testsuites><testsuite>
-<testcase classname='other' name='$name' time='`cat "${name}.t.out"`' timestamp='`date -Iseconds`'>
+<testcase classname='$c' name='$n' time='`cat "${name}.t.out"`' timestamp='`date -Iseconds`'>
 END
 if test "$res" != "0"; then
 echo >> "${name}.xml" "<error message='Command returned $res'/>"
index fe37ca9..9f31805 100644 (file)
@@ -228,7 +228,7 @@ redef class ModelBuilder
                        doc_entities += 1
                        tc = new HTMLTag("testcase")
                        # NOTE: jenkins expects a '.' in the classname attr
-                       tc.attr("classname", mmodule.full_name + ".<module>")
+                       tc.attr("classname", "nitunit." + mmodule.full_name + ".<module>")
                        tc.attr("name", "<module>")
                        d2m.extract(ndoc, tc)
                end label x
@@ -241,7 +241,7 @@ redef class ModelBuilder
                                if ndoc != null then
                                        doc_entities += 1
                                        tc = new HTMLTag("testcase")
-                                       tc.attr("classname", mmodule.full_name + "." + mclassdef.mclass.full_name)
+                                       tc.attr("classname", "nitunit." + mmodule.full_name + "." + mclassdef.mclass.full_name)
                                        tc.attr("name", "<class>")
                                        d2m.extract(ndoc, tc)
                                end
@@ -254,7 +254,7 @@ redef class ModelBuilder
                                if ndoc != null then
                                        doc_entities += 1
                                        tc = new HTMLTag("testcase")
-                                       tc.attr("classname", mmodule.full_name + "." + mclassdef.mclass.full_name)
+                                       tc.attr("classname", "nitunit." + mmodule.full_name + "." + mclassdef.mclass.full_name)
                                        tc.attr("name", mpropdef.mproperty.full_name)
                                        d2m.extract(ndoc, tc)
                                end
index 28e6945..25b1fc8 100644 (file)
@@ -272,7 +272,7 @@ class TestCase
                var mclassdef = test_method.mclassdef
                var tc = new HTMLTag("testcase")
                # NOTE: jenkins expects a '.' in the classname attr
-               tc.attr("classname", mclassdef.mmodule.full_name + "." + mclassdef.mclass.full_name)
+               tc.attr("classname", "nitunit." + mclassdef.mmodule.full_name + "." + mclassdef.mclass.full_name)
                tc.attr("name", test_method.mproperty.full_name)
                if was_exec then
                        tc.add  new HTMLTag("system-err")
index 6282781..087e573 100755 (executable)
@@ -9,11 +9,8 @@ printf "%s\n" "$@" *.nit \
        ../examples/pnacl/converter/converter.nit \
        ../examples/nitcorn/src/*.nit \
        ../examples/mpi/src/*.nit \
-       ../lib/*.nit \
-       ../lib/*/*.nit \
-       ../lib/*/*/*.nit  \
+       ../lib/*/examples/*.nit \
+       ../contrib/friendz/src/solver_cmd.nit \
+       ../contrib/pep8analysis/src/pep8analysis.nit \
        ../src/nit*.nit \
-       ../src/test_*.nit \
-       ../contrib/*.nit \
-       ../contrib/*/*.nit \
-       ../contrib/*/src/*.nit
+       ../src/test_*.nit
diff --git a/tests/puzzle.args b/tests/puzzle.args
new file mode 100644 (file)
index 0000000..fc5ae53
--- /dev/null
@@ -0,0 +1 @@
+eabf.cdgh
diff --git a/tests/sav/array_debug.res b/tests/sav/array_debug.res
deleted file mode 100644 (file)
index c4b2490..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*** No Array stats ***
diff --git a/tests/sav/friendz_linux.res b/tests/sav/friendz_linux.res
deleted file mode 100644 (file)
index c1dad34..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
diff --git a/tests/sav/hash_debug.res b/tests/sav/hash_debug.res
deleted file mode 100644 (file)
index 5946805..0000000
+++ /dev/null
@@ -1 +0,0 @@
-~~~No hash statistics~~~
diff --git a/tests/sav/javap_visitor.res b/tests/sav/javap_visitor.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/jwrapper.res b/tests/sav/jwrapper.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/linux_app.res b/tests/sav/linux_app.res
deleted file mode 100644 (file)
index c1dad34..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
diff --git a/tests/sav/linux_assets.res b/tests/sav/linux_assets.res
deleted file mode 100644 (file)
index c1dad34..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
diff --git a/tests/sav/mnit_linux.res b/tests/sav/mnit_linux.res
deleted file mode 100644 (file)
index c1dad34..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
diff --git a/tests/sav/mnit_null.res b/tests/sav/mnit_null.res
deleted file mode 100644 (file)
index 31c5498..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-GET injected_input_stream /dev/null
-END OF INPUTS
-END OF INPUT
diff --git a/tests/sav/nitcc.res b/tests/sav/nitcc.res
deleted file mode 100644 (file)
index e7370cf..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../contrib/nitcc/src/re2nfa.nit:18,8--18: Error: cannot find module nitcc_lexer from nitcc. tried alt, ../lib, ../contrib/nitcc
-../contrib/nitcc/src/nitcc_semantic.nit:21,8--19: Error: cannot find module nitcc_parser from nitcc. tried alt, ../lib, ../contrib/nitcc
diff --git a/tests/sav/nitcc_lexer0.res b/tests/sav/nitcc_lexer0.res
deleted file mode 100644 (file)
index 4096407..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/nitcc/src/nitcc_lexer0.nit:21,8--19: Error: cannot find module nitcc_parser from nitcc. tried alt, ../lib, ../contrib/nitcc
diff --git a/tests/sav/nitcc_parser_gen.res b/tests/sav/nitcc_parser_gen.res
deleted file mode 100644 (file)
index 7e99042..0000000
+++ /dev/null
@@ -1 +0,0 @@
-LR automaton: 93 states (see nitcc0.lr.dot)
diff --git a/tests/sav/nitcc_semantic.res b/tests/sav/nitcc_semantic.res
deleted file mode 100644 (file)
index e7370cf..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-../contrib/nitcc/src/re2nfa.nit:18,8--18: Error: cannot find module nitcc_lexer from nitcc. tried alt, ../lib, ../contrib/nitcc
-../contrib/nitcc/src/nitcc_semantic.nit:21,8--19: Error: cannot find module nitcc_parser from nitcc. tried alt, ../lib, ../contrib/nitcc
diff --git a/tests/sav/nitg-e/fixme/pnacl.res b/tests/sav/nitg-e/fixme/pnacl.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/nitg-g/fixme/pnacl.res b/tests/sav/nitg-g/fixme/pnacl.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/nitg-s/fixme/pnacl.res b/tests/sav/nitg-s/fixme/pnacl.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/nitg-s/fixme/sensors.res b/tests/sav/nitg-s/fixme/sensors.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/nitg-sg/fixme/pnacl.res b/tests/sav/nitg-sg/fixme/pnacl.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/nitg-sg/fixme/sensors.res b/tests/sav/nitg-sg/fixme/sensors.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
diff --git a/tests/sav/niti/mnit_injected_input.res b/tests/sav/niti/mnit_injected_input.res
deleted file mode 100644 (file)
index b40c338..0000000
+++ /dev/null
@@ -1 +0,0 @@
-GET injected_input_stream /dev/null
diff --git a/tests/sav/nitmd.res b/tests/sav/nitmd.res
deleted file mode 100644 (file)
index 3d4be6f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-usage: nitmd <file.md>
index e115c1d..3b5b590 100644 (file)
@@ -1,6 +1,6 @@
-test_nitunit.nit:20,1--22,0: ERROR: test_nitunit.test_nitunit::X.<class> (in .nitunit/test_nitunit2.nit): Runtime error: Assert failed (.nitunit/test_nitunit2.nit:5)
+test_nitunit.nit:20,1--22,0: ERROR: nitunit.test_nitunit.test_nitunit::X.<class> (in .nitunit/test_nitunit2.nit): Runtime error: Assert failed (.nitunit/test_nitunit2.nit:5)
 
-test_nitunit.nit:23,2--25,0: FAILURE: test_nitunit.test_nitunit::X.test_nitunit::X::foo (in .nitunit/test_nitunit3.nit): .nitunit/test_nitunit3.nit:5,8--27: Error: Method or variable 'undefined_identifier' unknown in Sys.
+test_nitunit.nit:23,2--25,0: FAILURE: nitunit.test_nitunit.test_nitunit::X.test_nitunit::X::foo (in .nitunit/test_nitunit3.nit): .nitunit/test_nitunit3.nit:5,8--27: Error: Method or variable 'undefined_identifier' unknown in Sys.
 
 test_test_nitunit.nit:36,2--40,4: ERROR: test_foo1 (in file .nitunit/test_test_nitunit_TestX_test_foo1.nit): Runtime error: Assert failed (test_test_nitunit.nit:39)
 
@@ -11,10 +11,10 @@ Entities: 27; Documented ones: 3; With nitunits: 3; Failures: 2
 
 TestSuites:
 Class suites: 1; Test Cases: 3; Failures: 1
-<testsuites><testsuite package="test_nitunit"><testcase classname="test_nitunit.&lt;module&gt;" name="&lt;module&gt;"><system-err></system-err><system-out>assert true
-</system-out></testcase><testcase classname="test_nitunit.test_nitunit::X" name="&lt;class&gt;"><system-err></system-err><system-out>assert false
+<testsuites><testsuite package="test_nitunit"><testcase classname="nitunit.test_nitunit.&lt;module&gt;" name="&lt;module&gt;"><system-err></system-err><system-out>assert true
+</system-out></testcase><testcase classname="nitunit.test_nitunit.test_nitunit::X" name="&lt;class&gt;"><system-err></system-err><system-out>assert false
 </system-out><error message="Runtime error: Assert failed (.nitunit/test_nitunit2.nit:5)
-"></error></testcase><testcase classname="test_nitunit.test_nitunit::X" name="test_nitunit::X::foo"><system-err></system-err><system-out>assert undefined_identifier
+"></error></testcase><testcase classname="nitunit.test_nitunit.test_nitunit::X" name="test_nitunit::X::foo"><system-err></system-err><system-out>assert undefined_identifier
 </system-out><failure message=".nitunit/test_nitunit3.nit:5,8--27: Error: Method or variable 'undefined_identifier' unknown in Sys.
-"></failure></testcase></testsuite><testsuite package="test_test_nitunit"><testcase classname="test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo"><system-err></system-err><system-out>out</system-out></testcase><testcase classname="test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo1"><system-err></system-err><system-out>out</system-out><error message="Runtime error: Assert failed (test_test_nitunit.nit:39)
-"></error></testcase><testcase classname="test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo2"><system-err></system-err><system-out>out</system-out></testcase></testsuite></testsuites>
\ No newline at end of file
+"></failure></testcase></testsuite><testsuite package="test_test_nitunit"><testcase classname="nitunit.test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo"><system-err></system-err><system-out>out</system-out></testcase><testcase classname="nitunit.test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo1"><system-err></system-err><system-out>out</system-out><error message="Runtime error: Assert failed (test_test_nitunit.nit:39)
+"></error></testcase><testcase classname="nitunit.test_test_nitunit.test_test_nitunit::TestX" name="test_test_nitunit::TestX::test_foo2"><system-err></system-err><system-out>out</system-out></testcase></testsuite></testsuites>
\ No newline at end of file
diff --git a/tests/sav/puzzle_args1.res b/tests/sav/puzzle_args1.res
new file mode 100644 (file)
index 0000000..17ccd5a
--- /dev/null
@@ -0,0 +1,6 @@
+Initial: eabf.cdgh
+eab
+f.c
+dgh
+Solved, after looking at 14 positions during 0.0s
+Solution in 10 moves: right(>) down(v) left(<) left(<) up(^) right(>) right(>) up(^) left(<) left(<)
diff --git a/tests/sav/re2nfa.res b/tests/sav/re2nfa.res
deleted file mode 100644 (file)
index 9f64398..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/nitcc/src/re2nfa.nit:18,8--18: Error: cannot find module nitcc_lexer from nitcc. tried alt, ../lib, ../contrib/nitcc
diff --git a/tests/sav/sort_downloads.res b/tests/sav/sort_downloads.res
deleted file mode 100644 (file)
index 247a630..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Not configured, make sure you modify the script and set is_configured to true
diff --git a/tests/sav/svg_to_icons.res b/tests/sav/svg_to_icons.res
deleted file mode 100644 (file)
index bd31810..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-You must specify one source drawing file
-You must specify a single format (--android or --large)
-Usage: svg_to_icons [Options] drawing.svg
-Options:
-  --out, -o       Where to output PNG files
-  --id, -i        Extract only object with given ID
-  --android, -a   Generate in the file structure for Android
-  --large, -l     Generate large icons (512 and 1024 px)
-  --help, -h      Print this help message
diff --git a/tests/sav/svg_to_png_and_nit.res b/tests/sav/svg_to_png_and_nit.res
deleted file mode 100644 (file)
index a685f7e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-You must specify at least one source drawing file
-Usage: svg_to_png_and_nit [Options] drawing.svg [Other files]
-Options:
-  --src, -s      Path to output source file
-  --assets, -a   Path to assert dir where to put PNG files
-  --scale, -x    Apply scaling to exported images (defaut at 1.0 of 90dpi)
-  --help, -h     Print this help message
index 6455466..32afdf0 100755 (executable)
@@ -397,7 +397,7 @@ for ii in "$@"; do
        fi
        f=`basename "$ii" .nit`
 
-       pack=`echo $ii | perl -p -e 's|^../([^/]*)/([a-zA-Z_]*).*|\1.\2| || s|^([a-zA-Z]*)[^_]*_([a-zA-Z]*).*|\1.\2| || s|\W*([a-zA-Z_]*).*|\1|'`
+       pack="tests.${engine}".`echo $ii | perl -p -e 's|^../([^/]*)/([a-zA-Z_]*).*|\1.\2| || s|^([a-zA-Z]*)[^_]*_([a-zA-Z]*).*|\1.\2| || s|\W*([a-zA-Z_]*).*|\1|'`
 
        # Sould we skip the file for this engine?
        need_skip $f $f $pack && continue
@@ -439,6 +439,7 @@ END
                        > "$ff.cmp.err"
                        > "$ff.compile.log"
                        ERR=0
+                       echo 0.0 > "$ff.time.out"
                else
                        if skip_cc "$bf"; then
                                nocc="--no-cc"
@@ -451,7 +452,7 @@ END
                                echo $NITC --no-color $OPT -o "$ffout" "$i" "$includes" $nocc
                        fi
                        NIT_NO_STACK=1 JNI_LIB_PATH=$JNI_LIB_PATH JAVA_HOME=$JAVA_HOME \
-                               /usr/bin/time -f%U -o "$ff.time.out" $TIMEOUT $NITC --no-color $OPT -o "$ffout" "$i" $includes $nocc 2> "$ff.cmp.err" > "$ff.compile.log"
+                               /usr/bin/time --quiet -f%U -o "$ff.time.out" $TIMEOUT $NITC --no-color $OPT -o "$ffout" "$i" $includes $nocc 2> "$ff.cmp.err" > "$ff.compile.log"
                        ERR=$?
                        if [ "x$verbose" = "xtrue" ]; then
                                cat "$ff.compile.log"
@@ -491,7 +492,10 @@ END
                                echo "NIT_NO_STACK=1 ./$ff.bin" $args
                        fi      
                        NIT_NO_STACK=1 LD_LIBRARY_PATH=$JNI_LIB_PATH \
-                               $TIMEOUT "./$ff.bin" $args < "$inputs" > "$ff.res" 2>"$ff.err"
+                               /usr/bin/time --quiet -f%U -a -o "$ff.time.out" $TIMEOUT "./$ff.bin" $args < "$inputs" > "$ff.res" 2>"$ff.err"
+                       mv $ff.time.out $ff.times.out
+                       awk '{ SUM += $1} END { print SUM }' $ff.times.out > $ff.time.out
+
                        if [ "x$verbose" = "xtrue" ]; then
                                cat "$ff.res"
                                cat >&2 "$ff.err"
@@ -533,7 +537,7 @@ END
                                        echo -n "==> $name "
                                        echo "./$ff.bin $args" > "./$fff.bin"
                                        chmod +x "./$fff.bin"
-                                       WRITE="$fff.write" /usr/bin/time -f%U -o "$fff.time.out" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $ffinputs > $fff.res 2>$fff.err"
+                                       WRITE="$fff.write" /usr/bin/time --quiet -f%U -o "$fff.time.out" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $ffinputs > $fff.res 2>$fff.err"
                                        if [ "x$verbose" = "xtrue" ]; then
                                                cat "$fff.res"
                                                cat >&2 "$fff.err"