Small modifications of the API that will be required for future pull requests such as Splay ropes and Bufferized ropes.
Pull-Request: #518
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
Clement de Figueiredo <clement.defigueiredo@gmail.com>
Christophe Gigax <christophe.gigax@viacesi.fr>
+
+Julien Pagès <julien.projet@gmail.com>
--- /dev/null
+#!/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.
+
+# Common functions for all the bench scripts
+
+# Run a single command multiple time and store the execution times
+# in the current $res file.
+#
+# $1: title of the command
+# $2: long desription of the command
+# rest: the command to execute
+function bench_command()
+{
+ if [ "$dry_run" = "true" ]; then return; fi
+ local title="$1"
+ local desc="$2"
+ shift
+ shift
+ if test "$verbose" = true; then outputopts="/dev/stdout"; else outputopts="/dev/null"; fi
+ timeout="time.out"
+ echo "$title" > "$timeout"
+ echo "# $desc" >> "$timeout"
+ echo "\$ $@" >> "$timeout"
+ echo
+ echo "** [$title] $desc **"
+ echo " $ $@"
+
+ # Execute the commands $count times
+ for i in `seq 1 "$count"`; do
+ /usr/bin/time -f "%U" -o "$timeout" -a "$@" > $outputopts 2>&1 || die "$1: failed"
+ echo -n "$i. "
+ tail -n 1 "$timeout"
+ done
+
+ line=`compute_stats "$timeout"`
+ echo "$line ($res)"
+ echo $line >> "$res"
+}
+
+# Run a simble command witout storing the execution time
+# Used to display command on verbose and skip long executions when dry_run is given
+# $@ command to execute
+function run_command()
+{
+ if [ "$dry_run" = "true" ]; then return; fi
+ echo " $ $@"
+ "$@" || die "$@: failed"
+}
+
+# Check if the test should be skiped according to its name
+# $1: name of the test
+# $2: description of the test
+# $NOTSKIPED: arguments
+function skip_test()
+{
+ if test -z "$NOTSKIPED"; then
+ echo "* $1"
+ return 0
+ fi
+ if test "$NOTSKIPED" = "all"; then
+ : # Execute anyway
+ elif echo "$1" | egrep "$NOTSKIPED" >/dev/null 2>&1; then
+ : # Found one to execute
+ else
+ return 0
+ fi
+ if test -n "$html"; then
+ echo >>"$html" "<h2>$1</h2>"
+ fi
+ echo "*"
+ echo "* $1 *****"
+ echo "*"
+ return 1
+}
+
# TODO: cleanup and libify the helper-parts
+source ./bench_common.sh
source ./bench_plot.sh
## CONFIGURATION OPTIONS ##
died=1
}
-# Run a single command multiple time and store the execution times
-# in the current $res file.
-#
-# $1: title of the command
-# $2: long desription of the command
-# rest: the command to execute
-function bench_command()
-{
- if [ "$dry_run" = "true" ]; then return; fi
- local title="$1"
- local desc="$2"
- shift
- shift
- if test "$verbose" = true; then outputopts="/dev/stdout"; else outputopts="/dev/null"; fi
- timeout="time.out"
- echo "$title" > "$timeout"
- echo "# $desc" >> "$timeout"
- echo "\$ $@" >> "$timeout"
- echo
- echo "** [$title] $desc **"
- echo " $ $@"
-
- # Execute the commands $count times
- for i in `seq 1 "$count"`; do
- /usr/bin/time -f "%U" -o "$timeout" -a "$@" > $outputopts 2>&1 || die "$1: failed"
- echo -n "$i. "
- tail -n 1 "$timeout"
- done
-
- line=`compute_stats "$timeout"`
- echo "$line ($res)"
- echo $line >> "$res"
-}
-
-# Run a simble command witout storing the execution time
-# Used to display command on verbose and skip long executions when dry_run is given
-# $@ command to execute
-function run_command()
-{
- if [ "$dry_run" = "true" ]; then return; fi
- echo " $ $@"
- "$@" || die "$@: failed"
-}
-
-# Check if the test should be skiped according to its name
-# $1: name of the test
-# $2: description of the test
-# $NOTSKIPED: arguments
-function skip_test()
-{
- if test -z "$NOTSKIPED"; then
- echo "* $1"
- return 0
- fi
- if test "$NOTSKIPED" = "all"; then
- : # Execute anyway
- elif echo "$1" | egrep "$NOTSKIPED" >/dev/null 2>&1; then
- : # Found one to execute
- else
- return 0
- fi
- if test -n "$html"; then
- echo >>"$html" "<h2>$1</h2>"
- fi
- echo "*"
- echo "* $1 *****"
- echo "*"
- return 1
-}
-
# HELPER FOR NIT #
# Run standards benchs on a compiler command
# TODO: cleanup and libify the helper-parts
+source ./bench_common.sh
source ./bench_plot.sh
## CONFIGURATION OPTIONS ##
died=1
}
-# Run a single command multiple time and store the execution times
-# in the current $res file.
-#
-# $1: title of the command
-# $2: long desription of the command
-# rest: the command to execute
-function bench_command()
-{
- if [ "$dry_run" = "true" ]; then return; fi
- local title="$1"
- local desc="$2"
- shift
- shift
- if test "$verbose" = true; then outputopts="/dev/stdout"; else outputopts="/dev/null"; fi
- timeout="time.out"
- echo "$title" > "$timeout"
- echo "# $desc" >> "$timeout"
- echo "\$ $@" >> "$timeout"
- echo
- echo "** [$title] $desc **"
- echo " $ $@"
-
- # Execute the commands $count times
- for i in `seq 1 "$count"`; do
- (ulimit -t 300; /usr/bin/time -f "%U" -o "$timeout" -a "$@") > $outputopts 2>&1 || die "$1: failed"
- echo -n "$i. "
- tail -n 1 "$timeout"
- done
-
- line=`compute_stats "$timeout"`
- echo "$line ($res)"
- echo $line >> "$res"
- rm $timeout
-}
-
-# Run a simple command witout storing the execution time
-# Used to display command on verbose and skip long executions when dry_run is given
-# $@ command to execute
-function run_command()
-{
- if [ "$dry_run" = "true" ]; then return; fi
- echo " $ $@"
- (ulimit -t 180; "$@") || die "$@: failed"
-}
-
-# Check if the test should be skiped according to its name
-# $1: name of the test
-# $2: description of the test
-# $NOTSKIPED: arguments
-function skip_test()
-{
- if test -z "$NOTSKIPED"; then
- echo "* $1"
- return 0
- fi
- if test "$NOTSKIPED" = "all"; then
- : # Execute anyway
- elif echo "$1" | egrep "$NOTSKIPED" >/dev/null 2>&1; then
- : # Found one to execute
- else
- return 0
- fi
- echo "*"
- echo "* $1 *****"
- echo "*"
- return 1
-}
-
## HANDLE OPTIONS ##
function usage()
CC = ccache cc
-CFLAGS = -g -O2
+CFLAGS = -g -O2 -Wno-unused-value -Wno-switch
CINCL = -I "clib"
LDFLAGS ?=
-LDLIBS ?= -lm -lgc -lunwind
+LDLIBS ?= -lm -lgc
+
+NEED_LIBUNWIND := YesPlease
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+ifeq ($(uname_S),Darwin)
+ NEED_LIBUNWIND :=
+endif
+
+clang_check := $(shell sh -c '$(CC) -v 2>&1 | grep -q clang; echo $$?')
+ifeq ($(clang_check), 0)
+ CFLAGS += -Qunused-arguments
+endif
+ifdef NEED_LIBUNWIND
+ LDLIBS += -lunwind
+endif
all: nitg
# limitations under the License.
NITCOPT=
+OLDNITCOPT= --no-stacktrace
all: ../bin/nitdoc ../bin/nitmetrics ../bin/nitg ../bin/nit ../bin/nitx ../bin/nitunit ../bin/nitlight ../bin/nitls ../bin/nitdbg_client
@echo '* Compile nitg_0 from NIT source files *'
@echo '***************************************************************'
./git-gen-version.sh
- ../c_src/nitg ${NITCOPT} -o nitg_0 -v nitg.nit
+ ../c_src/nitg ${OLDNITCOPT} -o nitg_0 -v nitg.nit
../bin/nitg: nitg_0 parser/parser.nit
@echo '***************************************************************'
if libs != null then linker_options.add_all(libs)
end
+ makefile.write("CC = ccache cc\nCFLAGS = -g -O2 -Wno-unused-value -Wno-switch\nCINCL = {cc_includes}\nLDFLAGS ?= \nLDLIBS ?= -lm -lgc {linker_options.join(" ")}\n\n")
+
var ost = toolcontext.opt_stacktrace.value
- if ost == "libunwind" or ost == "nitstack" then linker_options.add("-lunwind")
+ if ost == "libunwind" or ost == "nitstack" then makefile.write("NEED_LIBUNWIND := YesPlease\n")
+
+ # Dynamic adaptations
+ # While `platform` enable complex toolchains, they are statically applied
+ # For a dynamic adaptsation of the compilation, the generated Makefile should check and adapt things itself
+
+ # Check and adapt the targeted system
+ makefile.write("uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n")
+ makefile.write("ifeq ($(uname_S),Darwin)\n")
+ # remove -lunwind since it is already included on macosx
+ makefile.write("\tNEED_LIBUNWIND :=\n")
+ makefile.write("endif\n\n")
+
+ # Check and adapt for the compiler used
+ # clang need an additionnal `-Qunused-arguments`
+ makefile.write("clang_check := $(shell sh -c '$(CC) -v 2>&1 | grep -q clang; echo $$?')\nifeq ($(clang_check), 0)\n\tCFLAGS += -Qunused-arguments\nendif\n")
+
+ makefile.write("ifdef NEED_LIBUNWIND\n\tLDLIBS += -lunwind\nendif\n")
- makefile.write("CC = ccache cc\nCFLAGS = -g -O2\nCINCL = {cc_includes}\nLDFLAGS ?= \nLDLIBS ?= -lm -lgc {linker_options.join(" ")}\n\n")
makefile.write("all: {outpath}\n\n")
var ofiles = new Array[String]
intrude import local_var_init
intrude import scope
intrude import toolcontext
-import websocket
redef class Model
# Cleans the model to remove a module and what it defines when semantic analysis fails on injected code
# -c
var opt_debugger_autorun: OptionBool = new OptionBool("Launches the target program with the interpreter, such as when the program fails, the debugging prompt is summoned", "-c")
- # --socket
- var opt_socket_mode = new OptionBool("Launches the target program with raw output on the network via sockets", "--socket")
-
- # --websocket
- var opt_websocket_mode = new OptionBool("Launches the target program with output on the network via websockets", "--websocket")
-
- # --port
- var opt_debug_port: OptionInt = new OptionInt("Sets the debug port (Defaults to 22125) - Must be contained between 0 and 65535", 22125, "--port")
-
redef init
do
super
self.option_context.add_option(self.opt_debugger_mode)
self.option_context.add_option(self.opt_debugger_autorun)
- self.option_context.add_option(self.opt_socket_mode)
- self.option_context.add_option(self.opt_websocket_mode)
- self.option_context.add_option(self.opt_debug_port)
end
end
var interpreter = new Debugger(self, mainmodule, arguments)
- set_stdstreams
-
init_naive_interpreter(interpreter, mainmodule)
- close_stdstreams
-
var time1 = get_time
self.toolcontext.info("*** END INTERPRETING: {time1-time0} ***", 2)
end
var interpreter = new Debugger(self, mainmodule, arguments)
interpreter.autocontinue = true
- set_stdstreams
-
init_naive_interpreter(interpreter, mainmodule)
- close_stdstreams
-
var time1 = get_time
self.toolcontext.info("*** END INTERPRETING: {time1-time0} ***", 2)
end
-
- redef fun run_naive_interpreter(mmod, args)
- do
- set_stdstreams
- super
- end
-
- fun set_stdstreams
- do
- if self.toolcontext.opt_socket_mode.value then
- var sock = new Socket.server(toolcontext.opt_debug_port.value, 1)
- var ns = sock.accept
- sock.close
- sys.set_io(ns,ns,ns)
- else if self.toolcontext.opt_websocket_mode.value then
- var websock = new WebSocket(toolcontext.opt_debug_port.value, 1)
- websock.accept
- sys.set_io(websock,websock,websock)
- end
- end
-
- fun close_stdstreams
- do
- if sys.stdin isa WebSocket or sys.stdin isa Socket then
- sys.stdin.close
- sys.stdout.close
- sys.stderr.close
- end
- end
-end
-
-redef class Sys
- private fun set_io(istream: PollableIStream, ostream: OStream, errstream: OStream)
- do
- self.stdin = istream
- self.stdout = ostream
- self.stderr = ostream
- end
end
# The class extending `NaiveInterpreter` by adding debugging methods
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2014 Johan Kayser <kayser.johan@gmail.com>
+#
+# 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.
+
+# Debugging of a nit program using sockets.
+module debugger_socket
+
+intrude import debugger
+import websocket
+
+redef class ToolContext
+ # --socket
+ var opt_socket_mode = new OptionBool("Launches the target program with raw output on the network via sockets", "--socket")
+
+ # --websocket
+ var opt_websocket_mode = new OptionBool("Launches the target program with output on the network via websockets", "--websocket")
+
+ # --port
+ var opt_debug_port: OptionInt = new OptionInt("Sets the debug port (Defaults to 22125) - Must be contained between 0 and 65535", 22125, "--port")
+
+ redef init
+ do
+ super
+ self.option_context.add_option(self.opt_socket_mode)
+ self.option_context.add_option(self.opt_websocket_mode)
+ self.option_context.add_option(self.opt_debug_port)
+ end
+end
+
+redef class ModelBuilder
+ # Execute the program from the entry point (Sys::main) of the `mainmodule`
+ # `arguments` are the command-line arguments in order
+ # REQUIRE that:
+ # 1. the AST is fully loaded.
+ # 2. the model is fully built.
+ # 3. the instructions are fully analysed.
+ redef fun run_debugger(mainmodule: MModule, arguments: Array[String])
+ do
+ var time0 = get_time
+ self.toolcontext.info("*** START INTERPRETING ***", 1)
+
+ var interpreter = new Debugger(self, mainmodule, arguments)
+
+ set_stdstreams
+
+ init_naive_interpreter(interpreter, mainmodule)
+
+ close_stdstreams
+
+ var time1 = get_time
+ self.toolcontext.info("*** END INTERPRETING: {time1-time0} ***", 2)
+ end
+
+ redef fun run_debugger_autorun(mainmodule: MModule, arguments: Array[String])
+ do
+ var time0 = get_time
+ self.toolcontext.info("*** START INTERPRETING ***", 1)
+
+ var interpreter = new Debugger(self, mainmodule, arguments)
+ interpreter.autocontinue = true
+
+ set_stdstreams
+
+ init_naive_interpreter(interpreter, mainmodule)
+
+ close_stdstreams
+
+ var time1 = get_time
+ self.toolcontext.info("*** END INTERPRETING: {time1-time0} ***", 2)
+ end
+
+ redef fun run_naive_interpreter(mmod, args)
+ do
+ set_stdstreams
+ super
+ end
+
+ fun set_stdstreams
+ do
+ if self.toolcontext.opt_socket_mode.value then
+ var sock = new Socket.server(toolcontext.opt_debug_port.value, 1)
+ var ns = sock.accept
+ sock.close
+ sys.set_io(ns,ns,ns)
+ else if self.toolcontext.opt_websocket_mode.value then
+ var websock = new WebSocket(toolcontext.opt_debug_port.value, 1)
+ websock.accept
+ sys.set_io(websock,websock,websock)
+ end
+ end
+
+ fun close_stdstreams
+ do
+ if sys.stdin isa WebSocket or sys.stdin isa Socket then
+ sys.stdin.close
+ sys.stdout.close
+ sys.stderr.close
+ end
+ end
+end
+
+redef class Sys
+ private fun set_io(istream: PollableIStream, ostream: OStream, errstream: OStream)
+ do
+ self.stdin = istream
+ self.stdout = ostream
+ self.stderr = ostream
+ end
+end
# Compile class names (for the class_name and output_class_name methods)
protected fun compile_class_names do
var v = new_visitor
- self.header.add_decl("extern const char const * class_names[];")
- v.add("const char const * class_names[] = \{")
+ self.header.add_decl("extern const char *class_names[];")
+ v.add("const char *class_names[] = \{")
for t in self.runtime_type_analysis.live_types do
v.add("\"{t}\", /* {self.classid(t)} */")
end
perl -i -npe 's#"\.\./.*?([^/]*.h)"#"\1"#' "$out"/*.[ch]
perl -i -npe 's#\S*/([^/]*.[ch])#\1#' "$out/Makefile"
perl -i -npe 's#\.\./clib#.#' "$out/Makefile"
+
+# Remove old compilation flags
+sed -i -e 's/OLDNITCOPT=.*/OLDNITCOPT=/' src/Makefile
import naive_interpreter
import debugger
+import debugger_socket
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
#alt4#1.foo(c2).output
#alt5#d1.foo(c2).output
c1.foo(c2).output
+'\n'.output
interface Inline__
fun foo do 1.output
- fun bar: Int = 2
+ fun bar: Int do return 2
end
class A
interface Inline__
fun foo do bar.output
- fun bar: Int = 2
+ fun bar: Int do return 2
fun baz is abstract
end
test2.output_class_name
test3.output_class_name
test4.output_class_name
+'\n'.output
if i == 2 then a = 2
#1alt3#if i == 3 then a = '3'
if a == null then 0.output else a.output
+ '\n'.output
end
test(1)
end
end
-printn(tak(37,12,6))
+print(tak(37,12,6))
--- /dev/null
+init_inherit
+init_linext
--- /dev/null
+import emscripten
+redef class IFStream
+ redef fun fill_buffer
+ do
+ print "NOT YET IMPLEMENTED"
+ abort
+ end
+ redef init open(f)
+ do
+ print "NOT YET IMPLEMENTED"
+ abort
+ end
+end
init_inherit
init_linext
-inline
-test_json
-converter
-pnacl
init_inherit
init_linext
-inline
nitg
-mnit
-pnacl
init_inherit
init_linext
-inline
-test_json
-converter
-pnacl
--- /dev/null
+init_inherit
+init_linext
init_inherit
init_linext
-inline
test_mem
shoot_logic
bench_
fun foo
do
self.o.output
+ '\n'.output
self.a.output
self.b.output
#alt2#self.c.output
var b = new B
b.foo
+'\n'.output
1
1
1
-a
\ No newline at end of file
+a
Test
Test
MyArray[Int]
-0
\ No newline at end of file
+0
1
+
2
-3
\ No newline at end of file
+
+3
1
+
2
-3
\ No newline at end of file
+
+3
-12
\ No newline at end of file
+12
--- /dev/null
+Not executable (platform?)
--- /dev/null
+100
+200
+300
--- /dev/null
+20
+20
+20
--- /dev/null
+A10
+B9
+A8
+B7
+A6
+B5
+A4
+B3
+A2
+B1
+A0
+B10
+A9
+B8
+A7
+B6
+A5
+B4
+A3
+B2
+A1
+B0
--- /dev/null
+Runtime error: Abstract method `generate_input` called on `App` (../lib/mnit/mnit_app.nit:64)
Test
Test
MyArray
-0
\ No newline at end of file
+0
1
1
a1
-a
\ No newline at end of file
+a
1
1
1
-aa
\ No newline at end of file
+aa
1
1
1
-a
\ No newline at end of file
+a
1
1
1
-aa
\ No newline at end of file
+aa
1
1
1
-a
\ No newline at end of file
+a
-Caught signal : Segmentation fault
+UNDEFINED
1
1
a1
-a
\ No newline at end of file
+a
1
1
1
-aa
\ No newline at end of file
+aa
1
1
1
-a
\ No newline at end of file
+a
--- /dev/null
+0
+0
+1
+2
+10
+20
+30
--- /dev/null
+1
+0
+1
+2
+10
+20
+30
--- /dev/null
+0
+0
+0
+1
+2
+10
+20
+30
--- /dev/null
+10
+0
+1
+2
+10
+20
+30
--- /dev/null
+10
+20
+0
+1
+2
+10
+20
+30
--- /dev/null
+Compilation error
--- /dev/null
+Compilation error
--- /dev/null
+1
+1
+a1
+a
--- /dev/null
+1
+1
+1
+aa
--- /dev/null
+1
+1
+1
+1
+a
--- /dev/null
+true
+true
+false
+true
+true
--- /dev/null
+true
+true
+true
+false
+true
--- /dev/null
+true
+true
+true
+true
+true
--- /dev/null
+Fatal error: limitation in the rapidtype analysis engine: a type depth of 256 is too important, the problematic type is G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[G[Int]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]].
--- /dev/null
+2
+2
+!2
+!100
--- /dev/null
+Cast error: Cannot cast Char to Int.
+2
--- /dev/null
+Cast error: Cannot cast Char to Int.
+2
-Runtime error: Uninitialized attribute @a (alt/rterror_attr_def_alt7.nit:48)
-c
\ No newline at end of file
+Runtime error: Uninitialized attribute @a (alt/rterror_attr_def_alt7.nit:49)
+c
Runtime error: Uninitialized attribute @a (alt/rterror_attr_def_alt7.nit:24)
-c
\ No newline at end of file
+c
-Runtime error: Receiver is null (alt/rterror_attr_def_alt8.nit:49)
-c1
+Runtime error: Receiver is null (alt/rterror_attr_def_alt8.nit:50)
+c
+1
+++ /dev/null
-p: 5q: 67
\ No newline at end of file
+++ /dev/null
-2**0*1*
\ No newline at end of file
+++ /dev/null
-2530513
\ No newline at end of file
+++ /dev/null
-55125012
\ No newline at end of file
+++ /dev/null
-0010110010
\ No newline at end of file
+++ /dev/null
-012345
\ No newline at end of file
+++ /dev/null
-11111
\ No newline at end of file
-bonjourndjui
\ No newline at end of file
+bonjour
+ndjui
+++ /dev/null
-D34=578
\ No newline at end of file
+++ /dev/null
-11211221122132
\ No newline at end of file
-112155
\ No newline at end of file
+11
+21
+55
+++ /dev/null
-abcdefghijklnmopqrstuvwxyz
-#"\
\ No newline at end of file
--- /dev/null
+Error: other error
+Warning: some warning
+0
var limit = 2.0
if args.length != 1 then
- printn("Usage: shootout_mandelbrot <size>\n")
+ print("Usage: shootout_mandelbrot <size>")
return
end
var byte_acc = 0
var bit_num = 0
-printn("P4\n{w} {h}\n")
+print("P4\n{w} {h}")
for y in [0..h[ do
for x in [0..w[ do
end
end
end
+print ""
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-class A
- fun p=(i: Int)
- do
- printn("p: ", i)
- end
- fun q=(i: Int, j: Int)
- do
- printn("q: ", i, j)
- end
-
- init
- do
- end
-end
-
-var a = new A
-a.p = 5
-a.q(6) = 7
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
-class Ant
- redef fun to_s: String
- do
- return "*"
- end
-
- init do end
-end
-
-var t = [new Ant, new Ant]
-printn(t.length)
-printn(t)
-var i = 0
-while i < t.length do
- printn(i)
- printn(t[i])
- i = i + 1
-end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
- var t = [5,3]
- printn(t.length)
- printn(t)
- var i = 0
- while i < t.length do
- printn(i)
- printn(t[i])
- i = i + 1
- end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-redef class Sys
- var _i: Int = 0
- var _j: Int = 0
- redef fun main
- do
- printn(5)
- _i = 5
- printn(_i)
- _i = 12
- printn(_i)
- _j = 50
- printn(_j)
- printn(_i)
- end
-end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-class A
- var _a_: Int = 0
-
- fun a: Int
- do
- return _a_ * 10
- end
-
- fun a=(a: Int)
- do
- _a_ = a / 10
- end
-
-
-
- init
- do
- end
-end
-
-
-var a = new A
-printn(a.a, a._a_)
-a.a = 10
-printn(a.a, a._a_)
-a._a_ = 10
-printn(a.a, a._a_)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
- do
- printn(0)
- end
- var a = 1
- do
- printn(a)
- end
- var b = 2
- while b < 3 do
- printn(b)
- b = b + 1
- end
- var c = 3
- while c < 4 do
- printn(c)
- c = c + 1
- end
- var d = 4
- var e = 2
- while e > 0 do
- printn(d)
- d = d + 1
- e = e - 1
- end
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-var a = true
-var b = false
-
-if true then
- printn(1)
-else if false then
- printn(0)
-else if true then
- printn(0)
-else
- printn(0)
-end
-
-if false then
- printn(0)
-else if false then
- printn(0)
-else if true then
- printn(1)
-else
- printn(0)
-end
-
-if false then
- printn(0)
-else if false then
- printn(0)
-else
- printn(1)
-end
-
-if a then
- printn(1)
-else
- printn(0)
-end
-
-if b then
- printn(0)
-else
- printn(1)
-end
# See the License for the specific language governing permissions and
# limitations under the License.
-printn(gets)
-printn(gets)
+print(gets)
+print(gets)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
-class A
- fun foo
- do
- printn("A")
- end
- fun blup(a: Int)
- do
- blup2(a, 1)
- end
- fun blup2(a: Int, b : Int)
- do
- printn(a+b)
- end
- fun blop(a: Int, b: Int...)
- do
- var i = b.iterator
- while i.is_ok do
- printn(a+i.item)
- i.next
- end
- end
-end
-
-class B
- super A
- redef fun foo
- do
- printn("B")
- end
-end
-
-class C
- super A
- fun foo2
- do
- printn("C")
- end
-end
-
-class D
- super B
- super C
- redef fun foo
- do
- printn("D")
- end
-
- init do end
-end
-
-fun test1
-do
- var b: B
- b = new D
- b.foo
- b.blup2(1,2)
- b.blup(3)
-end
-
-fun test2
-do
- var b = new D
- var a = [1,2,3]
- var u: Object
- printn("=",5)
- b.blop(5,2,3)
-end
-
-test1
-test2
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
-class O
- fun foo
- do
- printn(10)
- end
-
- fun bar
- do
- printn(20)
- end
-
- init do end
-end
-
-class A
- super O
- redef fun foo
- do
- printn(11)
- end
-
- redef fun bar
- do
- printn(21)
- end
-
- init do end
-end
-
-class B
- super A
- redef fun foo
- do
- printn(12)
- end
-
- fun baz
- do
- printn(32)
- end
-
- init do end
-end
-
-var a = new A
-var ab: A = new B
-var b = new B
-a.foo
-a.bar
-ab.foo
-ab.bar
-b.foo
-b.bar
-b.baz
m[1,1] = 11
m[2,1] = 21
m[5,5] = 55
-printn(m[1,1])
-printn(m[2,1])
-printn(m[5,5])
+print(m[1,1])
+print(m[2,1])
+print(m[5,5])
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2004-2008 Jean Privat <jean@pryen.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.
-
-
-printn("abcdefghijklnmopqrstuvwxyz")
-printn("\n#\"\\")
-for x in nitg-g nitg-s nitg-e niti; do
+for x in nitg-g nitg-s nitg-sg nitg-e niti; do
echo "--engine $x"
./tests.sh --engine $x "$@"
done
# Set lang do default to avoid failed tests because of locale
export LANG=C
+export LC_ALL=C
export NIT_TESTING=true
unset NIT_DIR
-o option Pass option to the engine
-v Verbose (show tests steps)
-h This help
---tap Produce TAP output
--engine Use a specific engine (default=nitg)
--noskip Do not skip a test even if the .skip file matches
---[no]soso Force enable (or disable) SOSO
END
}
local pattern="$1"
local sav="$2"
if [ ! -r "$sav" ]; then return 0; fi
+ test "`cat "$sav"`" = "UNDEFINED" && return 1
diff -u "$sav" "out/$pattern.res" > "out/$pattern.diff.sav.log"
if [ "$?" == 0 ]; then
return 1
fi
- [ -z "$soso" ] && return 3
sed '/[Ww]arning/d;/[Ee]rror/d' "out/$pattern.res" > "out/$pattern.res2"
sed '/[Ww]arning/d;/[Ee]rror/d' "$sav" > "out/$pattern.sav2"
grep '[Ee]rror' "out/$pattern.res" >/dev/null && echo "Error" >> "out/$pattern.res2"
grep '[Ee]rror' "$sav" >/dev/null && echo "Error" >> "out/$pattern.sav2"
- diff -u "out/$pattern.sav2" "out/$pattern.res2" > "out/$pattern.diff.sav.log"
+ diff -u "out/$pattern.sav2" "out/$pattern.res2" > "out/$pattern.diff.sav.log2"
if [ "$?" == 0 ]; then
return 2
else
# As argument: the pattern used for the file
function process_result()
{
- ((tapcount=tapcount+1))
# Result
pattern=$1
description=$2
echo >>$xml "<testcase classname='$pack' name='$description'>"
#for sav in "sav/$engine/fixme/$pattern.res" "sav/$engine/$pattern.res" "sav/fixme/$pattern.res" "sav/$pattern.res" "sav/$pattern.sav"; do
for savdir in $savdirs; do
- sav=$savdir/$pattern.res
+ sav=$savdir/fixme/$pattern.res
compare_to_result "$pattern" "$sav"
-
- case "$? $sav" in
- 0*)
- continue;; # no file
- 1*/fixme/*)
+ case "$?" in
+ 0)
+ ;; # no file
+ 1)
OLD="$LIST"
FIXME="$sav"
+ LIST="$LIST $sav"
;;
- 1*)
+ 2)
+ if [ -z "$FIRST" ]; then
+ SOSOF="$sav"
+ FIRST="$sav"
+ fi
+ LIST="$LIST $sav"
+ ;;
+ 3)
+ if [ -z "$FIRST" ]; then
+ NFIXME="$sav"
+ FIRST="$sav"
+ fi
+ LIST="$LIST $sav"
+ ;;
+ esac
+
+ sav=$savdir/$pattern.res
+ compare_to_result "$pattern" "$sav"
+ case "$?" in
+ 0)
+ ;; # no file
+ 1)
OLD="$LIST"
SAV="$sav"
+ LIST="$LIST $sav"
;;
- 2*/fixme/*)
- SOSOF="$sav" ;;
- 2*)
- SOSO="$sav" ;;
- 3*/fixme/*)
+ 2)
if [ -z "$FIRST" ]; then
- NFIXME="$sav"
+ SOSO="$sav"
FIRST="$sav"
fi
+ LIST="$LIST $sav"
;;
- 3*)
+ 3)
if [ -z "$FIRST" ]; then
NSAV="$sav"
FIRST="$sav"
fi
+ LIST="$LIST $sav"
;;
esac
- LIST="$LIST $sav"
done
OLD=`echo "$OLD" | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`
grep 'NOT YET IMPLEMENTED' "out/$pattern.res" >/dev/null
NYI="$?"
if [ -n "$SAV" ]; then
- if [ -n "$tap" ]; then
- echo "ok - $description"
- elif [ -n "$OLD" ]; then
+ if [ -n "$OLD" ]; then
echo "[*ok*] out/$pattern.res $SAV - but $OLD remains!"
echo >>$xml "<error message='ok out/$pattern.res - but $OLD remains'/>"
remains="$remains $OLD"
fi
ok="$ok $pattern"
elif [ -n "$FIXME" ]; then
- if [ -n "$tap" ]; then
- echo "not ok - $description # TODO expected failure"
- elif [ -n "$OLD" ]; then
+ if [ -n "$OLD" ]; then
echo "[*fixme*] out/$pattern.res $FIXME - but $OLD remains!"
echo >>$xml "<error message='ok out/$pattern.res - but $OLD remains'/>"
remains="$remains $OLD"
echo >>$xml "<skipped/>"
fi
todos="$todos $pattern"
- elif [ -n "$SOSO" ]; then
- if [ -n "$tap" ]; then
- echo "ok - $description # SOSO"
- else
- echo "[soso] out/$pattern.res $SOSO"
- fi
- ok="$ok $pattern"
elif [ "x$NYI" = "x0" ]; then
- if [ -n "$tap" ]; then
- echo "not ok - $description # TODO not yet implemented"
- else
- echo "[todo] out/$pattern.res -> not yet implemented"
- echo >>$xml "<skipped/>"
- fi
+ echo "[todo] out/$pattern.res -> not yet implemented"
+ echo >>$xml "<skipped/>"
todos="$todos $pattern"
+ elif [ -n "$SOSO" ]; then
+ echo "[======= soso out/$pattern.res $SOSO =======]"
+ echo >>$xml "<error message='soso out/$pattern.res $SOSO'/>"
+ echo >>$xml "<system-out><![CDATA["
+ cat -v out/$pattern.diff.sav.log | head >>$xml -n 50
+ echo >>$xml "]]></system-out>"
+ nok="$nok $pattern"
+ echo "$ii" >> "$ERRLIST"
elif [ -n "$SOSOF" ]; then
- if [ -n "$tap" ]; then
- echo "not ok - $description # TODO SOSO expected failure"
- else
- echo "[fixme soso] out/$pattern.res $SOSOF"
- echo >>$xml "<skipped/>"
- fi
- todos="$todos $pattern"
+ echo "[======= fixme soso out/$pattern.res $SOSOF =======]"
+ echo >>$xml "<error message='soso out/$pattern.res $SOSO'/>"
+ echo >>$xml "<system-out><![CDATA["
+ cat -v out/$pattern.diff.sav.log | head >>$xml -n 50
+ echo >>$xml "]]></system-out>"
+ nok="$nok $pattern"
+ echo "$ii" >> "$ERRLIST"
elif [ -n "$NSAV" ]; then
- if [ -n "$tap" ]; then
- echo "not ok - $description"
- else
- echo "[======= fail out/$pattern.res $NSAV =======]"
- fi
+ echo "[======= fail out/$pattern.res $NSAV =======]"
echo >>$xml "<error message='fail out/$pattern.res $NSAV'/>"
echo >>$xml "<system-out><![CDATA["
cat -v out/$pattern.diff.sav.log | head >>$xml -n 50
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
elif [ -n "$NFIXME" ]; then
- if [ -n "$tap" ]; then
- echo "not ok - $description"
- else
- echo "[======= changed out/$pattern.res $NFIXME ======]"
- fi
+ echo "[======= changed out/$pattern.res $NFIXME ======]"
echo >>$xml "<error message='changed out/$pattern.res $NFIXME'/>"
echo >>$xml "<system-out><![CDATA["
cat -v out/$pattern.diff.sav.log | head >>$xml -n 50
nok="$nok $pattern"
echo "$ii" >> "$ERRLIST"
elif [ -s out/$pattern.res ]; then
- if [ -n "$tap" ]; then
- echo "no ok - $description"
- else
- echo "[=== no sav ===] out/$pattern.res is not empty"
- fi
+ echo "[=== no sav ===] out/$pattern.res is not empty"
echo >>$xml "<error message='no sav and not empty'/>"
echo >>$xml "<system-out><![CDATA["
cat -v >>$xml out/$pattern.res
nos="$nos $pattern"
else
# no sav but empty res
- if [ -n "$tap" ]; then
- echo "ok - $description"
- else
- echo "[0k] out/$pattern.res is empty"
- fi
+ echo "[0k] out/$pattern.res is empty"
ok="$ok $pattern"
fi
if test -s out/$pattern.cmp.err; then
{
test "$noskip" = true && return 1
if echo "$1" | grep -f "$engine.skip" >/dev/null 2>&1; then
- ((tapcount=tapcount+1))
- if [ -n "$tap" ]; then
- echo "ok - $2 # skip"
- else
- echo "=> $2: [skip]"
- fi
+ echo "=> $2: [skip]"
echo >>$xml "<testcase classname='$3' name='$2'><skipped/></testcase>"
return 0
fi
if test $engine = niti && echo "$1" | grep -f "exec.skip" >/dev/null 2>&1; then
- ((tapcount=tapcount+1))
- if [ -n "$tap" ]; then
- echo "ok - $2 # skip"
- else
- echo "=> $2: [skip exec]"
- fi
+ echo "=> $2: [skip exec]"
echo >>$xml "<testcase classname='$3' name='$2'><skipped/></testcase>"
return 0
fi
find_nitc()
{
- ((tapcount=tapcount+1))
name="$enginebinname"
recent=`ls -t ../src/$name ../src/$name_[0-9] ../bin/$name ../c_src/$name 2>/dev/null | head -1`
if [[ "x$recent" == "x" ]]; then
- if [ -n "$tap" ]; then
- echo "not ok - find binary for $engine"
- echo "Bail out! Could not find binary for engine $engine, aborting"
- else
- echo "Could not find binary for engine $engine, aborting"
- fi
+ echo "Could not find binary for engine $engine, aborting"
exit 1
fi
- if [ -n "$tap" ]; then
- echo "ok - find binary for $engine: $recent $OPT"
- else
- echo "Find binary for engine $engine: $recent $OPT"
- fi
+ echo "Find binary for engine $engine: $recent $OPT"
NITC=$recent
}
verbose=false
stop=false
-tapcount=0
engine=nitg
noskip=
+savdirs=
while [ $stop = false ]; do
case $1 in
-o) OPT="$OPT $2"; shift; shift;;
-v) verbose=true; shift;;
-h) usage; exit;;
- --tap) tap=true; shift;;
--engine) engine="$2"; shift; shift;;
--noskip) noskip=true; shift;;
- --soso) soso=true; shift;;
- --nososo) nososo=true; shift;;
*) stop=true
esac
done
nitg)
engine=nitg-s;
enginebinname=nitg;
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
OPT="--separate $OPT"
;;
nitg-s)
enginebinname=nitg;
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
OPT="--separate $OPT"
;;
nitg-e)
enginebinname=nitg;
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
OPT="--erasure $OPT"
;;
+ nitg-sg)
+ enginebinname=nitg;
+ OPT="--semi-global $OPT"
+ ;;
nitg-g)
enginebinname=nitg;
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
OPT="--global $OPT"
;;
nit)
engine=niti
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
;;
niti)
enginebinname=nit
- savdirs="sav/$engine/fixme/ sav/$engine/ sav/fixme/ sav/"
+ ;;
+ emscripten)
+ enginebinname=nitg
+ OPT="-m emscripten_nodejs.nit --semi-global $OPT"
+ savdirs="sav/nitg-sg/"
;;
nitc)
echo "disabled engine $engine"
;;
esac
+savdirs="sav/$engine $savdirs sav/"
+
# The default nitc compiler
[ -z "$NITC" ] && find_nitc
# Sould we skip the alternative for this engine?
need_skip $bf $bf $pack && continue
- test -z "$tap" && echo -n "=> $bf: "
+ echo -n "=> $bf: "
if [ -f "$f.inputs" ]; then
inputs="$f.inputs"
inputs=/dev/null
fi
+ ffout="$ff.bin"
+ if [ "$engine" = "emscripten" ]; then
+ ffout="$ff.bin.js"
+ fi
+
if [ "$engine" = "niti" ]; then
cat > "./$ff.bin" <<END
exec $NITC --no-color $OPT "$i" $includes -- "\$@"
# Compile
if [ "x$verbose" = "xtrue" ]; then
echo ""
- echo $NITC --no-color $OPT -o "$ff.bin" "$i" "$includes" $nocc
+ 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 \
- $TIMEOUT $NITC --no-color $OPT -o "$ff.bin" "$i" $includes $nocc 2> "$ff.cmp.err" > "$ff.compile.log"
+ $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"
cat >&2 "$ff.cmp.err"
fi
fi
+ if [ "$engine" = "emscripten" ]; then
+ echo > "./$ff.bin" "nodejs $ffout \"\$@\""
+ chmod +x "$ff.bin"
+ if grep "Fatal Error: more than one primitive class" "$ff.compile.log" > /dev/null; then
+ echo " [skip] do no not imports kernel"
+ echo >>$xml "<testcase classname='$pack' name='$bf'><skipped/></testcase>"
+ continue
+ fi
+ fi
if [ "$ERR" != 0 ]; then
- test -z "$tap" && echo -n "! "
+ echo -n "! "
cat "$ff.compile.log" "$ff.cmp.err" > "$ff.res"
process_result $bf $bf $pack
elif skip_exec "$bf"; then
process_result $bf $bf $pack
elif [ -n "$nocc" ]; then
# not compiled
- test -z "$tap" && echo -n "nocc "
+ echo -n "nocc "
> "$ff.res"
process_result $bf $bf $pack
elif [ -x "./$ff.bin" ]; then
- test -z "$tap" && echo -n ". "
+ echo -n ". "
# Execute
args=""
if [ "x$verbose" = "xtrue" ]; then
echo ""
echo "NIT_NO_STACK=1 ./$ff.bin" $args
fi
- test -z "$tap" && echo -n "==> $name "
+ echo -n "==> $name "
echo "./$ff.bin $args" > "./$fff.bin"
chmod +x "./$fff.bin"
WRITE="$fff.write" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $ffinputs > $fff.res 2>$fff.err"
echo "Not executable (platform?)" > "$ff.res"
process_result $bf "$bf" $pack
else
- test -z "$tap" && echo -n "! "
+ echo -n "! "
cat "$ff.cmp.err" > "$ff.res"
echo "Compilation error" > "$ff.res"
process_result $bf "$bf" $pack
done
done
-if [ -n "$tap" ]; then
- echo "1..$tapcount"
- echo "# ok:" `echo $ok | wc -w`
- echo "# not ok:" `echo $nok | wc -w`
- echo "# no sav:" `echo $nos | wc -w`
- echo "# todo/fixme:" `echo $todos | wc -w`
- echo "# of sav that remains:" `echo $remains | wc -w`
- exit
-fi
-
echo "engine: $engine ($enginebinname $OPT)"
echo "ok: " `echo $ok | wc -w` "/" `echo $ok $nok $nos $todos | wc -w`
--- /dev/null
+import kernel
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import kernel
+1.output
--- /dev/null
+import string
+0.output
+"Error: bla bla".output
--- /dev/null
+import string
+"NOT YET IMPLEMENTED".output