Help debugging a mysterious alcotest failure on github CI

I’m trying to run alcotest via github actions. dune runtest works locally, and runs fine on the osx workflow in github. On an identical ubuntu workflow it fails with

File "tests/dune", line 2, characters 8-15:
2 |  (names get_set)
            ^^^^^^^
(cd _build/default/tests && ./get_set.exe)
Testing `Get and set tests'.
This run has ID `92CCY7V2'.

Error: Process completed with exit code 1.

I’m not even sure how to debug this; it is clearly getting as far as invoking alcotest and then failing, but there is neither a test failure nor a segfault in the logs. Link to failed run here: Run ocaml tests from the github CI · martindemello/ocaml-gtk@08c3d5f · GitHub

Can you try running it with backtraces turned on?

thanks, didn’t realise it was off by default. did a rerun but the backtrace had nothing relevant in it :frowning:

(cd _build/default/tests && ./get_set.exe)
Testing `Get and set tests'.
This run has ID `UX97GNKL'.
Raised at Dune_engine__process.Handle_exit_status.fail in file
  "src/dune_engine/process.ml", line 494, characters 4-68
Called from Dune_engine__process.run_internal.(fun) in file
  "src/dune_engine/process.ml", line 819, characters 12-210
Called from Fiber__core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250,
  characters 36-41
Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 73,
  characters 8-11
Re-raised at Stdune__exn.raise_with_backtrace in file
  "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
Called from Stdune__exn_with_backtrace.reraise in file
  "otherlibs/stdune/exn_with_backtrace.ml", line 18, characters 33-71
Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 73,
  characters 8-11
Re-raised at Stdune__exn.raise_with_backtrace in file
  "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
Called from Stdune__exn_with_backtrace.reraise in file
  "otherlibs/stdune/exn_with_backtrace.ml", line 18, characters 33-71
Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 73,
  characters 8-11
Error: Process completed with exit code 1.

It looks like parts of the output are getting truncated. Maybe stderr is getting lost? You could try redirecting it explicitly to stdout.

Does compiling your project with debugging info and adding OCAMLRUNPARAM=b give any further details?

There are some warnings in the C compilation that might be relevant:

2023-02-07T04:08:16.7150664Z ml_Gio.c:2316:3: warning: implicit declaration of function ‘g_desktop_app_info_launch_action’; did you mean ‘ml_Gio_DesktopAppInfo_launch_action’? [-Wimplicit-function-declaration]
2023-02-07T04:08:16.7151208Z  2316 |   g_desktop_app_info_launch_action(GObject_val(instance_), String_val(action_name), GObject_val(launch_context));
2023-02-07T04:08:16.7151534Z       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-02-07T04:08:16.7151767Z       |   ml_Gio_DesktopAppInfo_launch_action

didn’t make any difference to the output :frowning: i changed the github workflow to

    - name: Run ocaml tests
      run: |
        eval `opam env`
        dune runtest --debug-backtraces 2>&1
      env:
        PREFIX: /usr/lib/x86_64-linux-gnu
        OCAMLRUNPARAM: b

and the dune file to add

  (dev
    (flags (:standard -w -33 -g))))

and the output was unchanged, just the dune runner backtrace and “process completed with exit code 1”. i couldn’t run it in bytecode mode due to the gtk dependency.

i’ll try looking into the C warnings, but this runs fine on a local debian system.

In case you haven’t made progress on debugging, here’s a suggestion:

when you run something in dune, it puts the actual command used in the “_build/log” file. You can get that command and run it yourself. Then, you could run it under the github CI. If that fails, it might be easier to debug (no dune wrapper to get in the way). If it succeeds, it might tell you that it’s dune getting in the way in some bad manner. Also, can you retrieve that “_build/log” file? Might tell you things if you compare it with the same file when you build locally.

2 Likes