Skip to content

Commit

Permalink
More test (#355)
Browse files Browse the repository at this point in the history
* More tests in the CI

- Fix test/runtest.sh to run outside the OCaml distribution
- Fix test/runtest.sh to run on windows
- Add CI step for test/runtest.sh
- Run camlp4 related test with ocaml 5.2

* test/test9/test.sh: add missing quotes to command parameters

Co-authored-by: Kate <kit-ty-kate@outlook.com>

---------

Co-authored-by: Kate <kit-ty-kate@outlook.com>
  • Loading branch information
hhugo and kit-ty-kate authored Dec 3, 2024
1 parent f519456 commit 9852d83
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

# Quoted strings with newlines
testsuite/internal.ml text eol=lf
*.sh text eol=lf
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ jobs:
- run: opam exec -- opam install -v menhir
- run: opam exec -- make build_examples
- run: opam exec -- opam install -v camlp4
if: ${{ ! startsWith(steps.conf.outputs.ocamlversion, '5.2.') }}
if: matrix.ocaml-compiler != 'ocaml-variants.5.2.0+msvc'
- run: opam exec -- env OCB=ocamlbuild ./test/runtest.sh
shell: bash
- run: opam exec -- make test-external
if: ${{ ! startsWith(steps.conf.outputs.ocamlversion, '5.2.') }}
if: matrix.ocaml-compiler != 'ocaml-variants.5.2.0+msvc'
- run: opam exec -- opam install -v mtime.1.4.0 # this tests topkg, with stub libraries
- run: opam exec -- opam install -v inotify.2.3 # this tests oasis, with stub libraries
if: ${{ ! startsWith(steps.conf.outputs.ocamlversion, '5.') && runner.os != 'Windows' && runner.os != 'macOS' }}
Expand Down
14 changes: 3 additions & 11 deletions test/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@
set -e
cd `dirname $0`

export OCB=$PWD/../ocamlbuild.native
OCB=${OCB:-$PWD/../ocamlbuild.native}

myfiglet() {
figlet $@ | sed 's/ *$//'
}
export OCB

if figlet ""; then
BANNER=myfiglet
else
echo "Install figlet to have a better output, press enter to continue with echo"
read
BANNER=echo
fi
BANNER=echo

HERE=`pwd`

Expand Down
4 changes: 2 additions & 2 deletions test/test11/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ cd `dirname $0`
set -e
set -x
CMDOTPS="" # -- command args
BUILD="$OCB -I a -I b aa.byte aa.native -no-skip -classic-display $@"
BUILD="$OCB -I a -I b aa.byte aa.native -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
$BUILD1
echo looks if libs are there
ls _build/b/libb.cma _build/b/libb.cmxa _build/b/libb.a
ls _build/b/libb.cma _build/b/libb.cmxa
$BUILD2
$OCB -clean
1 change: 1 addition & 0 deletions test/test2/_tags
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
#########################################################################

"vivi.ml": camlp4o
true: package(camlp-streams)

# , some_useless_tag, \ more_useless_tags
9 changes: 8 additions & 1 deletion test/test2/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@
cd `dirname $0`
set -e
set -x
if ocamlfind query camlp4 camlp-streams -qo; then
echo "camlp4 and camlp-streams are installed";
else
echo "Missing dependencies: make sure camlp4 and camlp-streams are installed";
echo "SKIP";
exit 0;
fi
CMDOPTS="-- -help"
BUILD="$OCB toto.byte toto.native -no-skip -classic-display $@"
BUILD="$OCB toto.byte toto.native -use-ocamlfind -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down
2 changes: 1 addition & 1 deletion test/test3/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOTPS="" # -- command args
BUILD="$OCB a.byte a.native proj.docdir/index.html -no-skip -classic-display $@"
BUILD="$OCB a.byte a.native proj.docdir/index.html -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down
2 changes: 1 addition & 1 deletion test/test4/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOTPS="" # -- command args
BUILD="$OCB -I a -I b aa.byte aa.native -no-skip -classic-display $@"
BUILD="$OCB -I a -I b aa.byte aa.native -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down
2 changes: 1 addition & 1 deletion test/test5/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOPTS="" # -- command args
BUILD="$OCB d.byte d.native -no-skip -classic-display $@"
BUILD="$OCB d.byte d.native -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down
4 changes: 2 additions & 2 deletions test/test6/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -x
rm -rf _build
CMDOPTS="" # -- command args
BUILD="$OCB -no-skip main.byte -classic-display $@"
BUILD="$OCB main.byte -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
cp b.mli.v1 b.mli
Expand All @@ -36,4 +36,4 @@ else
echo FAIL
fi
$OCB -clean
rm {b,d}.mli
rm b.mli d.mli
2 changes: 1 addition & 1 deletion test/test7/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOPTS="" # -- command args
BUILD="$OCB bbcc.cma main.byte bbcc.cmxa main.native -no-skip -classic-display $@"
BUILD="$OCB bbcc.cma main.byte bbcc.cmxa main.native -classic-display $@"
BUILD1="$BUILD $CMDARGS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDARGS"
rm -rf _build
Expand Down
2 changes: 1 addition & 1 deletion test/test8/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOPTS="" # -- command args
BUILD="$OCB a.byte a.native a a.opt bin/a bin/a.opt -no-skip -classic-display $@"
BUILD="$OCB a.byte a.native a a.opt bin/a bin/a.opt -no-links -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down
7 changes: 6 additions & 1 deletion test/test9/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
set -e
set -x
cd `dirname $0`/../..
ocamlc -I src ocamlbuild_pack.cmo test/test9/testglob.ml -o ./testglob.native
if [ "$OCB" = "ocamlbuild" ]; then
set -- '-I' "$($OCB -where | tr -d '\r')"
else
set -- '-I' 'src' '-I' 'plugin-lib'
fi
ocamlc "$@" -I +unix unix.cma ocamlbuildlib.cma test/test9/testglob.ml -o ./testglob.native
./testglob.native
rm testglob.native
2 changes: 1 addition & 1 deletion test/test_virtual/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd `dirname $0`
set -e
set -x
CMDOPTS="" # -- command args
BUILD="$OCB bar -no-skip -no-links -classic-display $@"
BUILD="$OCB bar -no-links -classic-display $@"
BUILD1="$BUILD $CMDOPTS"
BUILD2="$BUILD -verbose 0 -nothing-should-be-rebuilt $CMDOPTS"
rm -rf _build
Expand Down

0 comments on commit 9852d83

Please sign in to comment.