Tritlo / PropR

Genetic program repair using GHC
MIT License
30 stars 2 forks source link

Issue with dynamic linking on MacOS #45

Open Tritlo opened 3 years ago

Tritlo commented 3 years ago

Issue when running cabal test

[...]
/Users/xxx/Endemic/dist-newstyle/build/x86_64-osx/ghc-8.10.1/Endemic-0.5.0/t/slow-test/test/Endemic-0.5.0-slow-test.log
0 of 1 test suites (0 of 1 test cases) passed.
Tests
  Utils
    dropPrefix:                               OK (0.03s)
      +++ OK, passed 100 tests.
    startsWith:                               OK
      +++ OK, passed 100 tests.
    boolToBitsInverse:                        OK
      +++ OK, passed 100 tests; 7 discarded.
    insertAt:                                 OK
      +++ OK, passed 100 tests; 138 discarded.
  Repair
    Repair `foldl (-) 0`:                     TIMEOUT (10.04s)
      Timed out after 10s
    GetExprCands finds important candidates:  OK (0.09s)
    Repair `gcd'` with gcd:                   OK (9.51s)
  Failing props
    Failing props for gcd:                    OK (3.60s)
    Only one failing prop:                    OK (1.58s)
    Two failing TastyProps:                   
tests/cases/TastyTwoFix.hs:3:1: error:
    Could not load module ‘Test.Tasty’
    It is a member of the hidden package ‘tasty-1.4.1’.
    You can run ‘:set -package tasty’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-1.4.1’.
    You can run ‘:set -package tasty’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import Test.Tasty
  | ^^^^^^^^^^^^^^^^^

tests/cases/TastyTwoFix.hs:4:1: error:
    Could not load module ‘Test.Tasty.HUnit’
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
    You can run ‘:set -package tasty-hunit’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
4 | import Test.Tasty.HUnit (testCase, (@?=))
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FAIL
      Exception: Could not load module ‘Test.Tasty’
      It is a member of the hidden package ‘tasty-1.4.1’.
      You can run ‘:set -package tasty’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-1.4.1’.
      You can run ‘:set -package tasty’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      Use -v (or `:set -v` in ghci) to see a list of the files searched for.
      Could not load module ‘Test.Tasty.HUnit’
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      It is a member of the hidden package ‘tasty-hunit-0.10.0.3’.
      You can run ‘:set -package tasty-hunit’ to expose it.
      (Note: this unloads all the modules in the current scope.)
      Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  Counter Examples
    Only one counter example:                 TIMEOUT (10.04s)
      Timed out after 10s
    Multiple examples:                        TIMEOUT (10.03s)
      Timed out after 10s
    No args loop fail:                        OK (5.26s)
  Trace tests
    Trace foldl:                              TIMEOUT (25.15s)
      Timed out after 10s
    Trace finds loop:                         OK (8.99s)
  Module tests
    Repair BrokenModule With Diff:            FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair BrokenModule finds correct target: FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair BrokenGCD:                         FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Repair MagicConstant:                     FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
  Sanctify tests
    Sanctify foldl program:                   FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1
    Fill foldl program:                       FAIL
      Exception: Variable not in scope: unfoldTastyTests :: a0 -> t0 a1

11 out of 21 tests failed (86.13s)

[...]

This is also the reason for the red CI

Originally posted by @lapplislazuli in https://github.com/Tritlo/Endemic/issues/44#issuecomment-886780942

Tritlo commented 3 years ago

Seems to work in the CI @lapplislazuli, are you doing something different?

Tritlo commented 3 years ago

@lapplislazuli note: the version of check-helpers was bumped, so you'll need to upgrade.

lapplislazuli commented 3 years ago

I deleted my .cabal, ran cabal update and re-installed the check-helpers. The issue above remains. Check-helpers is 0.0.4 and endemic is 0.5.0. But it seems similar to the issues with local imports? Just looking at the error message.

It seems to be a different one to the one in the CI

Tritlo commented 3 years ago

That's weird, since the bug you show is exactly what would happen if check-helpers was outdated. Did you delete:

The bug in the CI seems to be a fluke.

Local imports are now on master, but it's a different issue: there we look for the source code of any imported modules and add them as a target if they exsist, while here the global package seems to not be working.

Tritlo commented 3 years ago

@lapplislazuli could you pull master and see if you still get the issue?

lapplislazuli commented 3 years ago

On the current Master the issue is different for me.

I first deleted ~/.ghc and ~/.cabal, then ran cabal update, cabal install QuickCheck & cabal install --lib tasty tasty-hunit. In the repository I cleaned up using cabal clean, and removed all .o and .hi files from the tests directory.

In our Repository I ran the cabal configure ... as per readme, cabal install --lib check-helpers and then cabal run test. Most of the tests are green (including ones that need tasty imports, so the problem seems generally fixed), but one test fails:

    Two failing TastyProps:                   FAIL
      Exception: <interactive>: fatal:
          cannot find object file ‘tests/cases/TastyTwoFix.dyn_o’
          while linking an interpreted expression

This seems to be (somehow) a MacOS issue, as both Docker and the CI are fine.

lapplislazuli commented 3 years ago

The issues with Dyn_o also made it into normal cabal run:

Linking /Users/xxx/Endemic/dist-newstyle/build/x86_64-osx/ghc-8.10.1/Endemic-0.6.0/x/endemic/build/endemic/endemic ...
endemic: <interactive>: fatal:
    cannot find object file ‘examples/BrokenModule.dyn_o’
    while linking an interpreted expression
lapplislazuli commented 3 years ago

On deep contemplation, I think this is because my Mac needs dynamic compilation, but the fake targets are not compiled dynamicly. For the files .o- and .hi-files are created while my Mac only wants .dyn_o. I think this is solvable with a compiler-config.

Tritlo commented 3 years ago

Yes, that makes a lot of sense. However, we don't always link the new ones, esp. not with repInteractive. Have you tried with that on?