bogue icon indicating copy to clipboard operation
bogue copied to clipboard

Random testsuite failures

Open kit-ty-kate opened this issue 1 year ago • 13 comments

I'm not sure how to reproduce this but i ran opam install -t bogue in a controlled debian docker environment twice in the span of a couple days and one succeeded but the other failed with:

#=== ERROR while compiling bogue.20240928 =====================================#
# context              2.4.0~alpha1~dev | linux/x86_64 | ocaml-variants.5.3.0+trunk | file:///home/opam/opam-repository
# path                 ~/.opam/5.3/.opam-switch/build/bogue.20240928
# command              ~/.opam/5.3/bin/dune build -p bogue -j 1 @install @runtest
# exit-code            1
# env-file             ~/.opam/log/bogue-3685-c1eb8a.env
# output-file          ~/.opam/log/bogue-3685-c1eb8a.out
### output ###
# File "examples/dune", lines 10-19, characters 0-137:
# 10 | (rule
# 11 |  (alias runtest)
# 12 |  (action
# 13 |   (setenv
# 14 |    SDL_VIDEODRIVER
# 15 |    dummy
# 16 |    (setenv
# 17 |     BOGUE_DEBUG
# 18 |     true
# 19 |     (run ./examples.exe 00)))))
# (cd _build/default/examples && ./examples.exe 00)
# [0][0] :	 Warning: User variable 'LOG_TO_FILE' not found in config.
# [0][0] :	 Warning: Using LOG_TO_FILE=false
# [0][0] :	 I/O: Executable=examples.exe
# [0][0] :	 I/O: Invoking opam
# [45][0] :	 Warning: User variable 'DIR' not found in config.
# [45][0] :	 Warning: Using DIR=
# [49][0] :	 ERROR: Cannot find themes directory
# [49][0] :	 ERROR: (FATAL) Bogue configuration directory  does not exist, and system-wide config cannot be found.
# Cannot find bogue lib directory
# Trying to download a minimal Bogue config...
# sh: 1: wget: not found
# Fatal error: exception Failure("Cannot download rescue config. Aborting.")

kit-ty-kate avatar Oct 10 '24 11:10 kit-ty-kate

Hi when bogue does not find its share directory, it tries to download it from the internet, using wget, which fails here because wget is not found on the system.

what I don't understand is that this mechanism was designed for standalone applications made by bogue but not accompanied by the bogue library. In principle, when installing bogue as a library with opam, the share dir is automatically installed in the appropriate .opam/ subdir

sanette avatar Oct 11 '24 07:10 sanette

In principle, when installing bogue as a library with opam, the share dir is automatically installed in the appropriate .opam/ subdir

in that case i'm not sure why the testsuite ever worked in opam given installation is always done after the tests. Is there no fallback other than downloading it? (which is forbidden by the sandbox)

kit-ty-kate avatar Oct 11 '24 07:10 kit-ty-kate

I never really understood how opam and or dune installed assets, but yes running any bogue app requires some files (icons, font, etc.) to be installed in a reachable place. For reading, bogue tries many places (local dir, .opam dir, .config dir, app dir) but I'm not sure what is the correct way to save the files for the test suites

sanette avatar Oct 11 '24 08:10 sanette

Here is a copy of the logs of the CI: https://ocaml.ci.dev/github/sanette/bogue/commit/575404de51963d62d4729a1296468ef8e607a38d/variant/debian-12-5.2_opam-2.2 Somehow there the assets in the _build directory can be found. I wonder why this was not the case for you

/src: (run (shell "opam exec -- dune build @install @check @runtest && rm -rf _build"))
(cd _build/default/examples && ./examples.exe 00)
[0][0] :	 Warning: User variable 'LOG_TO_FILE' not found in config.
[0][0] :	 Warning: Using LOG_TO_FILE=false
[0][0] :	 I/O: Executable=examples.exe
[0][0] :	 I/O: Invoking opam
[25][0] :	 ERROR: Cannot find share directory for examples.exe/.! bin_dir=/src/_build/default/examples, prefix_dir=/src/_build/default
[25][0] :	 Warning: User variable 'DIR' not found in config.
[25][0] :	 Warning: Using DIR=
[30][0] :	 Warning: User variable 'THEME' not found in config.
[30][0] :	 Warning: Using THEME=default
[30][0] :	 I/O: No theme specified, using default=default
[30][0] :	 I/O: Reading config file [/src/_build/install/default/share/bogue/themes/default/bogue.conf]. BOGUE Version [20240928]

sanette avatar Oct 11 '24 09:10 sanette

is there a missing dependency toward that asset? If there is no dependency then the availability of that directory will be dependent on the machine (depending on the number of core and which task finished first)

kit-ty-kate avatar Oct 11 '24 09:10 kit-ty-kate

is there a missing dependency toward that asset?

probably not... what is the way to do this? EDIT: I mean that probably I didn't write the dependency explicitly

sanette avatar Oct 11 '24 09:10 sanette

what is the way to do this?

using (deps ...): https://dune.readthedocs.io/en/stable/reference/dune/rule.html#rule

kit-ty-kate avatar Oct 11 '24 09:10 kit-ty-kate

ok so I suppose that in the file examples/dune we should add (deps "share/bogue/themes/default/bogue.conf") is this the correct path prefix to indicate?

sanette avatar Oct 11 '24 09:10 sanette

well, I need to read more...

$ dune runtest
Error: No rule found for examples/share/bogue/themes/default/bogue.conf
-> required by alias examples/runtest in examples/dune:10

will try to think about it when I have more time. thanks for reporting!

sanette avatar Oct 11 '24 09:10 sanette

is this the correct path prefix to indicate?

probably not. That would ../<that path>, otherwise it would be the share/ directory inside examples/

kit-ty-kate avatar Oct 11 '24 09:10 kit-ty-kate

also you probably want (deps (file ...)) or (deps (source_tree ...)). See https://dune.readthedocs.io/en/stable/concepts/dependency-spec.html

kit-ty-kate avatar Oct 11 '24 09:10 kit-ty-kate

for me (deps "../share/themes/default/bogue.conf") seems to work...

sanette avatar Oct 11 '24 09:10 sanette

I pushed a tentative fix, could you test?

sanette avatar Oct 12 '24 07:10 sanette