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

Merge testsuite sub-makefiles in the root Makefile and harden build system #12706

Merged
merged 5 commits into from Nov 30, 2023

Conversation

shindere
Copy link
Contributor

This PR merges testsuite/{lib,tools}/Makefile into the root Makefile and does two additional perhaps more interesting things:

  1. If ocamltest is enabled, all the support libraries and tools required to run certain tests are built, too. This means that any test can then be run by ocamltest directly without having to necessarily go through make to ensure that the required libraries and tools are built. This fulfulls a wish expressed some time ago by @Octachron and I am pleased to offer this modest gift to him. @gasche may also like this, and the coming item, too.

  2. The PR makes it impossible to build ocamltest if it has not been enabled at configure time and gives an explicit error message explaining what is going on. This is an attempt to address Test failure when glibc has frame pointers #12587, more precisely a problem it revealed, see e.g. Test failure when glibc has frame pointers #12587 (comment) since if ocamltest is disabled at configuration time, this PR makes is then completely impossible to build it, even manually.

@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch 6 times, most recently from 08b325c to 25a97c4 Compare October 31, 2023 05:02
@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch 2 times, most recently from 68fe8f7 to 4f5d0de Compare October 31, 2023 08:14
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions here and there, with a couple of other thoughts:

  • Given the integration into the main Makefile, could we just move expect, codegen, testing and "lib" (which could be given a more descriptive name) to tools/ (in the same way that stripdebug, cmpbyt and other parts of the build system also live in tools)?
  • I fully support hardening the correct running of the testsuite, but I'm not overly keen on this approach. It is relatively easy to end up working on a tree where ocamltest wasn't built by default, and it's very pedantic and time-consuming to force the user to reconfigure the tree. I would prefer it to be that the test for, say, diff and everything is always done, but is only an error if ocamltest is explicitly requested and, consequently, that attempting to build ocamltest is only an error if it impossible to build.

testsuite/lib/testing.ml Outdated Show resolved Hide resolved
testsuite/lib/lib.mli Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@@ -1832,7 +1833,7 @@ $(ocamltest_DEP_FILES): $(DEPDIR)/ocamltest/%.$(D): ocamltest/%.c
ocamltest/%: CAMLC = $(BEST_OCAMLC) $(STDLIBFLAGS)

ocamltest: ocamltest/ocamltest$(EXE) \
testsuite/lib/lib.cmo testsuite/lib/testing.cma
testsuite/lib/lib.cmo testsuite/lib/testing.cma testsuite/tools/expect$(EXE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be here - isn't testsuite/tools/expect built as part of BYTECODE_OPTIONAL_TOOLS?

ocamltest/ocamltest$(EXE): OC_BYTECODE_LINKFLAGS += -custom

ocamltest/ocamltest$(EXE): ocamlc ocamlyacc ocamllex

ocamltest.opt: ocamltest/ocamltest.opt$(EXE) testsuite/lib/testing.cmxa
ocamltest.opt: ocamltest/ocamltest.opt$(EXE) \
testsuite/lib/testing.cmxa $(asmgen_OBJECT) testsuite/tools/codegen$(EXE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, isn't this part of the optional tools variable?

@@ -2314,7 +2319,8 @@ AS_CASE([$enable_ocamltest,OCAML__DEVELOPMENT_VERSION],
ocamltest_target=ocamltest
ocamltest_opt_target=ocamltest.opt
ocamltest='ocamltest'
],
testsuite_tools='testsuite/tools/codegen testsuite/tools/expect'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a further optimisation (I think) codegen is only needed if the native compiler is being built

@shindere
Copy link
Contributor Author

shindere commented Nov 21, 2023 via email

@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch from ad79c5a to 5fe3f8d Compare November 22, 2023 18:23
@shindere
Copy link
Contributor Author

Giving it a second thought, I believe that the code in this PR is actually correct as it is.

More specifically, regarding the discussions on where we should list the
libraries and tools to be built, the lists in configure.ac and the
dependencies in Makefile accomplish two different purposes. The fact that
the libraries and tools are listed in configre.ac is useful so that the
macros for building programs and libraries get called. But these macros
being called is not enough per se for the corresponding libraries and tools
to be actually built. The build will become effective only if the libraries
and tools appear as prerequisites of other rules, which is what is done in
the Makefile.

@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch from 5fe3f8d to 5d843ab Compare November 30, 2023 09:23
@shindere
Copy link
Contributor Author

I just pushed an update that takes into account @dra27's remark about
the Testing library module.

With this, I hope I have addressed all the review comments done so far.

@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch from 5d843ab to e1ba713 Compare November 30, 2023 15:02
@shindere shindere force-pushed the merge-testsuite-sub-makefiles branch from e1ba713 to c20c1ff Compare November 30, 2023 16:04
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dra27 dra27 linked an issue Nov 30, 2023 that may be closed by this pull request
@dra27 dra27 added the merge-me label Nov 30, 2023
@shindere
Copy link
Contributor Author

shindere commented Nov 30, 2023 via email

@shindere shindere merged commit d5b5c34 into ocaml:trunk Nov 30, 2023
10 checks passed
@shindere shindere deleted the merge-testsuite-sub-makefiles branch November 30, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure when glibc has frame pointers
2 participants