Skip to content

Commit

Permalink
Tests for -stop-after scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
gretay-js committed Oct 30, 2019
1 parent 7c11fcb commit 3f36ed3
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions ocamltest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config
-e 's|@@OCAMLDOC@@|$(WITH_OCAMLDOC)|' \
-e 's|@@OCAMLDEBUG@@|$(WITH_OCAMLDEBUG)|' \
-e 's|@@OBJEXT@@|$(O)|' \
-e 's|@@ASMEXT@@|$(S)|' \
-e 's|@@NATIVE_DYNLINK@@|$(NATDYNLINK)|' \
-e 's|@@SHARED_LIBRARY_CFLAGS@@|$(SHAREDLIB_CFLAGS)|' \
-e 's|@@SHAREDOBJEXT@@|$(SO)|' \
Expand Down
1 change: 1 addition & 0 deletions ocamltest/ocaml_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ let config_variables _log env =
Ocaml_variables.shared_library_cflags,
Ocamltest_config.shared_library_cflags;
Ocaml_variables.objext, Ocamltest_config.objext;
Ocaml_variables.asmext, Ocamltest_config.asmext;
Ocaml_variables.sharedobjext, Ocamltest_config.sharedobjext;
Ocaml_variables.ocamlc_default_flags,
Ocamltest_config.ocamlc_default_flags;
Expand Down
4 changes: 4 additions & 0 deletions ocamltest/ocaml_variables.ml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ let nativecc_libs = make ("nativecc_libs",
let objext = make ("objext",
"Extension of object files")

let asmext = make ("asmext",
"Extension of assembly files")

let ocamlc_byte = make ("ocamlc_byte",
"Path of the ocamlc.byte executable")

Expand Down Expand Up @@ -254,6 +257,7 @@ let _ = List.iter register_variable
modules;
nativecc_libs;
objext;
asmext;
ocamlc_byte;
ocamlopt_byte;
ocamlrun;
Expand Down
1 change: 1 addition & 0 deletions ocamltest/ocaml_variables.mli
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ val nativecc_libs : Variables.t
(** Libraries to link with for native code *)

val objext : Variables.t
val asmext : Variables.t

val ocamlc_byte : Variables.t
val ocamlopt_byte : Variables.t
Expand Down
2 changes: 2 additions & 0 deletions ocamltest/ocamltest_config.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ let str = @@STR@@

let objext = "@@OBJEXT@@"

let asmext = "@@ASMEXT@@"

let system = "@@SYSTEM@@"

let c_preprocessor = "@@CPP@@"
Expand Down
3 changes: 3 additions & 0 deletions ocamltest/ocamltest_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ val str : bool
val objext : string
(** Extension of object files *)

val asmext : string
(** Extension of assembly files *)

val system : string
(** The content of the SYSTEM Make variable *)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wrong argument 'scheduling'; option '-stop-after' expects one of: parsing typing.
14 changes: 14 additions & 0 deletions testsuite/tests/tool-ocamlc-stop-after/stop_after_scheduling.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(* TEST
* setup-ocamlc.byte-build-env
compiler_output = "compiler-output.raw"
** ocamlc.byte
flags = "-stop-after scheduling"
ocamlc_byte_exit_status = "2"
*** script
script = "sh ${test_source_directory}/stop_after_scheduling.sh"
output = "compiler-output"
**** check-ocamlc.byte-output
compiler_output = "compiler-output"
*)

(* this file is just a test driver, the test does not contain real OCaml code *)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

grep "wrong argument 'scheduling'" compiler-output.raw | grep "stop-after" | sed 's/^.*: wrong argument/wrong argument/'
12 changes: 12 additions & 0 deletions testsuite/tests/tool-ocamlopt-stop-after/stop_after_scheduling.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(* TEST
* native-compiler
** setup-ocamlopt.byte-build-env
*** ocamlopt.byte
flags = "-stop-after scheduling -S"
ocamlopt_byte_exit_status = "0"
**** check-ocamlopt.byte-output
***** script
script = "sh ${test_source_directory}/stop_after_scheduling.sh"
*)

(* this file is just a test driver, the test does not contain real OCaml code *)
24 changes: 24 additions & 0 deletions testsuite/tests/tool-ocamlopt-stop-after/stop_after_scheduling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

set -e

asm=stop_after_scheduling.${asmext}
obj=stop_after_scheduling.${objext}
cmx=stop_after_scheduling.cmx

# Check that cmx is generated but asm and obj are not
if [ -e "$asm" ] ; then
echo "unexpected $asm found" > ${ocamltest_response}
test_result=${TEST_FAIL}
else if [ -e "$obj" ] ; then
echo "unexpected $obj found" > ${ocamltest_response}
test_result=${TEST_FAIL}
else if [ -e "$cmx" ] ; then
test_result=${TEST_PASS}
else
echo "not found expected $cmx" > ${ocamltest_response}
test_result=${TEST_FAIL}
fi
fi
fi
exit ${test_result}
2 changes: 1 addition & 1 deletion testsuite/tests/unwind/check-linker-version.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ elif [[ $LDVER -lt 224 ]]; then
echo "ld version is $LDVER, only 224 or above are supported";
test_result=${TEST_SKIP};
else
test_reslut=${TEST_PASS};
test_result=${TEST_PASS};
fi

exit ${TEST_RESULT}

0 comments on commit 3f36ed3

Please sign in to comment.