solvuu / phat

Strongly typed file path and file system operations.
ISC License
26 stars 4 forks source link

some tests fail on Mac OS X #5

Open agarwal opened 8 years ago

agarwal commented 8 years ago

In dc22fa65d5f9ddb7943e9af7f75ea5141414592f, I ported the main library to async. The tests are now broken and also need to be ported.

agarwal commented 8 years ago

Some progress in 90444c17d51b757b4ca0132e17b088465388ba5f, but not sure if this commit got everything right since tests are failing. Need to review.

agarwal commented 8 years ago

@pveber I have 2 of 9 tests failing for me. Can you confirm if you're getting the same behavior.

pveber commented 8 years ago

Oddly, I don't. I tried to change the initialization of the RNG several times but I don't see any failing test. Some OSX-specific problem?

agarwal commented 8 years ago

You're right. It's only on my Mac. Just tried Ubuntu and it works fine. Here are the errors:

$ _build/app/run-ounit-tests.native 
.....EE..
==============================================================================
Error: Phat test suite:7:Create dir paths.

File "/Volumes/Solvuu/phat/_build/oUnit-Phat test suite-Ashish.local#01.log", line 38, characters 1-1:
Error: Phat test suite:7:Create dir paths (in the log).

Raised at file "src/result.ml", line 111, characters 23-26
Called from file "src/oUnitRunner.ml", line 46, characters 13-26

(src/monitor.ml.Error_
  ((exn
     ("OUnitTest.OUnit_failure(\"Filesys.mkdir failed to create path (Cons Root\\n (Cons (Dir var)\\n  (Cons (Dir folders)\\n   (Cons (Dir qd)\\n    (Cons (Dir 480pwlg91dg1ggqth6zxl1hm0000gn)\\n     (Cons (Dir T)\\n      (Cons (Dir ounit-964cb9-Ashish.local#01.dir)\\n       (Cons (Dir foo5407) (Cons (Dir foo5408) (Item (Dir foo5409)))))))))))\")"))
    (backtrace
      ("Raised at file \"src/oUnitAssert.ml\", line 45, characters 8-27"
        "Called from file \"src/deferred1.ml\", line 14, characters 64-67"
        "Called from file \"src/job_queue.ml\", line 164, characters 6-47"
        ""))
    (monitor
      (((name block_on_async) (here ()) (id 15) (has_seen_error true)
         (is_detached true) (kill_index 0))))))
------------------------------------------------------------------------------
==============================================================================
Error: Phat test suite:6:Exists test.

File "/Volumes/Solvuu/phat/_build/oUnit-Phat test suite-Ashish.local#01.log", line 15, characters 1-1:
Error: Phat test suite:6:Exists test (in the log).

Raised at file "src/result.ml", line 111, characters 23-26
Called from file "src/oUnitRunner.ml", line 46, characters 13-26

(src/monitor.ml.Error_
  ((exn
     ("OUnitTest.OUnit_failure(\"Failed to detect path (Item (Dir foo))\")"))
    (backtrace
      ("Raised at file \"src/oUnitAssert.ml\", line 45, characters 8-27"
        "Called from file \"src/deferred1.ml\", line 14, characters 64-67"
        "Called from file \"src/job_queue.ml\", line 164, characters 6-47"
        ""))
    (monitor
      (((name block_on_async) (here ()) (id 2) (has_seen_error true)
         (is_detached true) (kill_index 0))))))
------------------------------------------------------------------------------
Ran: 9 tests in: 0.12 seconds.
FAILED: Cases: 9 Tried: 9 Errors: 2 Failures: 0 Skip:  0 Todo: 0 Timeouts: 0.
agarwal commented 8 years ago

For the first error, I have this:

$ ll -d /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/
drwx------  214 ashish  staff   7.1K Oct 27 13:16 /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/

but the next directory ounit-964cb9-Ashish.local#01.dir doesn't exist, so is that the point at which it failed? I'm not sure why it would. It works manually:

$ mkdir /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/ounit-964cb9-Ashish.local#01.dir
(* no error, directory gets created *)
pveber commented 8 years ago

Maybe you could try to create it manually in utop and see what happens?

As for the second test, could you ls the contents of the temp directory after create_test_directory is called?

2015-10-27 18:19 GMT+01:00 Ashish Agarwal notifications@github.com:

For the first error, I have this:

$ ll -d /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/ drwx------ 214 ashish staff 7.1K Oct 27 13:16 /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/

but the next directory ounit-964cb9-Ashish.local#01.dir doesn't exist, so is that the point at which it failed? I'm not sure why it would. It works manually:

$ mkdir /var/folders/qd/480pwlg91dg1ggqth6zxl1hm0000gn/T/ounit-964cb9-Ashish.local#01.dir (* no error, directory gets created *)

— Reply to this email directly or view it on GitHub https://github.com/solvuu/phat/issues/5#issuecomment-151575444.

pveber commented 8 years ago

I just noticed that there was two important commits I had left behind (mistakenly left on the branch for the fold function since they only deal with exists and mkdir). Although the changes are not likely to clear this issue, but could you have a quick try, just to be sure?

agarwal commented 8 years ago

Now I get 3 errors. :) Maybe one is a new test you added, not sure. For our record, here's the output:

$ _build/app/run-ounit-tests.native 
.......EEE
==============================================================================
Error: Phat test suite:8:Create dir paths.

File "/Volumes/Solvuu/phat/_build/oUnit-Phat test suite-Ashish.fios-router.home#01.log", line 15, characters 1-1:
Error: Phat test suite:8:Create dir paths (in the log).

Raised at file "src/result.ml", line 111, characters 23-26
Called from file "src/oUnitRunner.ml", line 46, characters 13-26

(src/monitor.ml.Error_
  ((exn
     ("OUnitTest.OUnit_failure(\"Filesys.mkdir failed to create path (Cons Root\\n (Cons (Dir var)\\n  (Cons (Dir folders)\\n   (Cons (Dir qd)\\n    (Cons (Dir 480pwlg91dg1ggqth6zxl1hm0000gn)\\n     (Cons (Dir T)\\n      (Cons (Dir ounit-354a9b-Ashish.fios-router.home#01.dir)\\n       (Cons (Dir foo3748)\\n        (Cons (Dir foo3749)\\n         (Cons (Dir foo3750)\\n          (Cons (Dir foo3751)\\n           (Cons\\n            (Link foo3761\\n             (Cons\\n              (Link foo3758\\n               (Cons (Dir foo3752)\\n                (Cons\\n                 (Link foo3756\\n                  (Item\\n                   (Link foo3755 (Cons (Dir foo3753) (Item (Dir foo3754))))))\\n                 (Item (Dir foo3757)))))\\n              (Item (Link foo3760 (Item (Dir foo3759))))))\\n            (Item (Link foo3763 (Item (Dir foo3762))))))))))))))))\")"))
    (backtrace
      ("Raised at file \"src/oUnitAssert.ml\", line 45, characters 8-27"
        "Called from file \"src/deferred1.ml\", line 14, characters 64-67"
        "Called from file \"src/job_queue.ml\", line 164, characters 6-47"
        ""))
    (monitor
      (((name block_on_async) (here ()) (id 2) (has_seen_error true)
         (is_detached true) (kill_index 0))))))
------------------------------------------------------------------------------
==============================================================================
Error: Phat test suite:9:Create dirs with cycles.

File "/Volumes/Solvuu/phat/_build/oUnit-Phat test suite-Ashish.fios-router.home#02.log", line 35, characters 1-1:
Error: Phat test suite:9:Create dirs with cycles (in the log).

Raised at file "src/result.ml", line 111, characters 23-26
Called from file "src/oUnitRunner.ml", line 46, characters 13-26

(src/monitor.ml.Error_
  ((exn
     ("OUnitTest.OUnit_failure(\"Filesys.mkdir failed to create the cyclic path correctly.\")"))
    (backtrace
      ("Raised at file \"src/oUnitAssert.ml\", line 45, characters 8-27"
        "Called from file \"src/deferred1.ml\", line 14, characters 64-67"
        "Called from file \"src/job_queue.ml\", line 164, characters 6-47"
        ""))
    (monitor
      (((name block_on_async) (here ()) (id 15) (has_seen_error true)
         (is_detached true) (kill_index 0))))))
------------------------------------------------------------------------------
==============================================================================
Error: Phat test suite:7:Exists test.

File "/Volumes/Solvuu/phat/_build/oUnit-Phat test suite-Ashish.fios-router.home#02.log", line 12, characters 1-1:
Error: Phat test suite:7:Exists test (in the log).

Raised at file "src/result.ml", line 111, characters 23-26
Called from file "src/oUnitRunner.ml", line 46, characters 13-26

(src/monitor.ml.Error_
  ((exn
     ("OUnitTest.OUnit_failure(\"Failed to detect path (Item (Dir foo))\")"))
    (backtrace
      ("Raised at file \"src/oUnitAssert.ml\", line 45, characters 8-27"
        "Called from file \"src/deferred1.ml\", line 14, characters 64-67"
        "Called from file \"src/job_queue.ml\", line 164, characters 6-47"
        ""))
    (monitor
      (((name block_on_async) (here ()) (id 2) (has_seen_error true)
         (is_detached true) (kill_index 0))))))
------------------------------------------------------------------------------
Ran: 10 tests in: 0.12 seconds.
FAILED: Cases: 10 Tried: 10 Errors: 3 Failures: 0 Skip:  0 Todo: 0 Timeouts: 0.
agarwal commented 8 years ago

Changed title of this issue. The porting has been done. Remaining issue is to fix tests that fail on OS X.