Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harsher CI #4672

Merged
merged 7 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/scripts/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export OCAMLRUNPARAM=b
fi

./configure --prefix ~/local --with-mccs
if [ "$OPAM_TEST" != "1" ]; then
echo 'DUNE_PROFILE=dev' >> Makefile.config
fi

if [[ $OPAM_TEST$OPAM_COLD -eq 0 ]] ; then
make lib-ext
Expand Down
39 changes: 22 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ ifeq ($(findstring clean,$(MAKECMDGOALS)),)
-include Makefile.config
endif

# TODO: Replace --profile=$(DUNE_PROFILE) by --release when we require on dune >= 2.5

all: opam opam-installer
@

admin:
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) opam-admin.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) opam-admin.install

DUNE_PROMOTE_ARG =
DUNE_PROMOTE_ARG += --promote-install-files
Expand Down Expand Up @@ -39,6 +37,13 @@ JBUILDER_ARGS ?=
DUNE_ARGS ?= $(JBUILDER_ARGS)
DUNE_PROFILE ?= release

ifeq ($(DUNE_PROFILE_ARG),release)
# TODO Replace with --release when we require dune >= 2.5
DUNE_PROFILE_ARG = --profile=release
else
DUNE_PROFILE_ARG = --profile=$(DUNE_PROFILE)
endif

src_ext/dune-local/dune.exe: src_ext/dune-local.stamp $(DUNE_SECONDARY)
ifeq ($(DUNE_SECONDARY),)
cd src_ext/dune-local && ocaml bootstrap.ml
Expand All @@ -50,7 +55,7 @@ src_ext/dune-local.stamp:
$(MAKE) -C src_ext dune-local.stamp

dune: $(DUNE_DEP)
@$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) @install
@$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) @install

opam: $(DUNE_DEP) build-opam processed-opam.install
@$(LN_S) -f _build/default/src/client/opamMain.exe $@$(EXE)
Expand All @@ -66,7 +71,7 @@ opam-installer: $(DUNE_DEP) build-opam-installer processed-opam-installer.instal
@$(LN_S) -f _build/default/src/tools/opam_installer.exe $@$(EXE)

opam-admin.top: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) src/tools/opam_admin_topstart.bc
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) src/tools/opam_admin_topstart.bc
$(LN_S) -f _build/default/src/tools/opam_admin_topstart.bc $@$(EXE)

lib-ext:
Expand Down Expand Up @@ -121,23 +126,23 @@ opam-%.install: $(DUNE_DEP)

.PHONY: build-opam-installer
build-opam-installer: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install
opam-installer.install: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install

.PHONY: build-opam
build-opam: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install opam.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install opam.install
opam.install: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install opam.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-installer.install opam.install

OPAMLIBS = core format solver repository state client

opam-%: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-$*.install
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) opam-$*.install

opam-lib: $(DUNE_DEP)
$(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) $(patsubst %,opam-%.install,$(OPAMLIBS))
$(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) $(DUNE_PROMOTE_ARG) $(patsubst %,opam-%.install,$(OPAMLIBS))

installlib-%: opam-installer opam-%.install
$(if $(wildcard src_ext/lib/*),\
Expand Down Expand Up @@ -173,7 +178,7 @@ uninstall: opam.install

.PHONY: tests
tests: $(DUNE_DEP)
@$(DUNE) runtest --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) src/ tests/ --no-buffer; \
@$(DUNE) runtest $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) src/ tests/ --no-buffer; \
ret=$$?; \
echo "### TESTS RESULT SUMMARY ###"; \
for t in _build/default/tests/reftests/*.test; do \
Expand All @@ -200,19 +205,19 @@ crowbar-afl: $(DUNE_DEP)

# tests-local, tests-git
tests-%: $(DUNE_DEP)
$(DUNE) build $(DUNE_ARGS) --profile=$(DUNE_PROFILE) --root . @reftest-legacy-$* --force
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest-legacy-$* --force

reftest-gen: $(DUNE_DEP)
$(DUNE) build $(DUNE_ARGS) --profile=$(DUNE_PROFILE) --root . @reftest-gen --auto-promote --force
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest-gen --auto-promote --force

reftest-runner: $(DUNE_DEP)
$(DUNE) build $(DUNE_ARGS) --profile=$(DUNE_PROFILE) --root . tests/reftests/run.exe
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . tests/reftests/run.exe

reftests: $(DUNE_DEP)
$(DUNE) build $(DUNE_ARGS) --profile=$(DUNE_PROFILE) --root . @reftest
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest

reftests-%: $(DUNE_DEP)
$(DUNE) build $(DUNE_ARGS) --profile=$(DUNE_PROFILE) --root . @reftest-$* --force
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest-$* --force

reftests-meld:
meld `for t in tests/reftests/*.test; do echo --diff $$t _build/default/$${t%.test}.out; done`
Expand Down
4 changes: 3 additions & 1 deletion appveyor_build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ set PRIVATE_RUNTIME=
if "%OCAML_PORT:~0,5%" equ "mingw" set PRIVATE_RUNTIME=--with-private-runtime
set WITH_MCCS=--with-mccs
if "%DEP_MODE%" equ "lib-pkg" set WITH_MCCS=
"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER %LIB_PKG% && ./configure %PRIVATE_RUNTIME% %WITH_MCCS% %LIB_EXT% && make opam %POST_COMMAND%" || exit /b 1
"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER %LIB_PKG% && ./configure %PRIVATE_RUNTIME% %WITH_MCCS% %LIB_EXT%" || exit /b 1
"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && echo DUNE_PROFILE=dev >> Makefile.config" || exit /b 1
"%CYG_ROOT%\bin\bash.exe" -lc "cd $APPVEYOR_BUILD_FOLDER && make opam %POST_COMMAND%" || exit /b 1
goto :EOF

:test
Expand Down
9 changes: 8 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ endif
DUNE_PROFILE ?= release
DUNE_ARGS ?=

ifeq ($(DUNE_PROFILE_ARG),release)
# TODO Replace with --release when we require dune >= 2.5
DUNE_PROFILE_ARG = --profile=release
else
DUNE_PROFILE_ARG = --profile=$(DUNE_PROFILE)
endif

.PHONY: man html pages
all: html pages

Expand All @@ -38,7 +45,7 @@ man-html:

html:
rm -rf html
cd .. && $(DUNE) build --profile=$(DUNE_PROFILE) --root . $(DUNE_ARGS) @doc
cd .. && $(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) @doc
cp -r ../_build/default/_doc/_html html
sed 's/%{OPAMVERSION}%/'$(version)'/g' index.html > html/index.html
# Not to break older links, add manpages to the `ocamldoc` dir
Expand Down
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ New option/command/subcommand are prefixed with ◈.
* Add switch creation tests: (dead)locking and switch defitinion at action time [#4612 @rjbou]
* Remove debug information from reftest [#4612 @rjbou]
* Add preserved format test [#4634 @rjbou]
* Use the dev profile when testing [#4672 @dra27]

## Shell
*
Expand Down
12 changes: 11 additions & 1 deletion src/state/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
(libraries opam-repository)
(synopsis "OCaml Package Manager instance management library")
(modules_without_implementation OpamStateTypes)
(modules :standard \ flags)
(flags (:standard
(:include ../ocaml-flags-standard.sexp)
(:include ../ocaml-flags-configure.sexp)
(:include ../ocaml-context-flags.sexp)))
(:include ../ocaml-context-flags.sexp)
(:include flags.sexp)))
(wrapped false))

(rule
Expand Down Expand Up @@ -44,3 +46,11 @@
(system
"curl https://raw.githubusercontent.com/spdx/license-list-data/master/json/exceptions.json |
jq -rc '.exceptions | map(\" \\\"\" + .licenseExceptionId + \"\\\";\") | join(\"\\n\")'"))))

(rule
(with-stdout-to flags.ml
(echo "print_string (if String.sub Sys.ocaml_version 0 5 = \"4.02.\" then \"(-w -50)\" else \"()\")")))

(rule
(with-stdout-to flags.sexp
(run ocaml %{dep:flags.ml})))
1 change: 1 addition & 0 deletions src_ext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ build-pkg: clone-pkg $(PKG_EXTS:=.pkgbuild)
ext-ignore:
@echo "; This file is automatically generated" > dune
@echo "(dirs :standard \ dune-local $(filter-out dune-local $(SRC_EXTS),$(PKG_EXTS)))" >> dune
@echo "(vendored_dirs $(SRC_EXTS))" >> dune

clone: $(DUNE_CLONE) $(SRC_EXTS:=.stamp) | ext-ignore
@
Expand Down
3 changes: 2 additions & 1 deletion src_ext/dune-dose3-algo
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(library
(name algo)
(public_name dose3.algo)
(flags :standard -w -3)
; -no-strict-sequence not added until 4.03!
(flags (:standard \ -strict-sequence) -w -3)
(modules (:standard \ tests bench))
(libraries dose3.common ocamlgraph)
(preprocess (action (run %{bin:cppo} -D "OCAMLGRAPHVERSION 200" -V OCAML:%{ocaml_version} %{input-file}))))
3 changes: 2 additions & 1 deletion src_ext/dune-extlib-src
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(library
(name extlib)
(public_name extlib)
(flags :standard -w -3)
; -no-strict-sequence not added until 4.03!
(flags (:standard \ -strict-sequence) -w -3)
(modules (:standard \ configure install uChar uTF8))
(preprocess (action (run %{bin:cppo} %{read-lines:compat-level} %{input-file})))
(wrapped false))
Expand Down
14 changes: 2 additions & 12 deletions tests/reftests/run.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ let rec waitpid pid =

exception Command_failure of int * string * string

let str_replace filters s =
List.fold_left (fun s (re, by) ->
Re.replace_string (Re.compile re) ~by s)
s filters

let str_replace_path ?(escape=false) whichway filters s =
let escape =
if escape then Re.(replace_string (compile @@ char '\\') ~by:"\\\\")
Expand Down Expand Up @@ -300,11 +295,6 @@ module Parse = struct
rep space;
]

let re_cmd =
seq [group re_str_atom;
rep space;
rep @@ seq [group re_str_atom; rep space]]

let command str =
if str.[0] = '<' && str.[String.length str - 1] = '>' then
let f = String.sub str 1 (String.length str - 2) in
Expand Down Expand Up @@ -422,7 +412,7 @@ let rec list_remove x = function
| [] -> []
| y :: r -> if x = y then r else y :: list_remove x r

let run_test t ?(vars=[]) ~opam =
let run_test ?(vars=[]) ~opam t =
let opamroot0 = Filename.concat (Sys.getcwd ()) ("root-"^t.repo_hash) in
with_temp_dir @@ fun dir ->
let old_cwd = Sys.getcwd () in
Expand Down Expand Up @@ -473,7 +463,7 @@ let run_test t ?(vars=[]) ~opam =
if rl = el then (print_endline el; diffl acc r e)
else if expect_has rl then diffl (rl::acc) r (el :: e)
else (print_endline rl; diffl acc r (el :: e))
| [], e::el ->
| [], _::el ->
diffl acc [] el
| r, [] ->
assert (acc = []); List.iter print_endline r
Expand Down