tindzk / seed

Build tool for Scala projects
https://tindzk.github.io/seed/
Apache License 2.0
238 stars 13 forks source link

Fix tests #30

Closed megri closed 5 years ago

megri commented 5 years ago

I can't run all tests without getting errors. Seems like some path confusion. For instance, I get

- Normalise paths *** FAILED ***
  received /private/tmp/build != expected /tmp/build (IdeaSpec.scala:27)

but also a bunch of fails like this one:

- Generate and compile meta modules *** FAILED ***
  Throwable
    seed.cli.util.Exit$.error(Exit.scala:8)
    seed.process.ProcessHelper$.$anonfun$runCommmand$5(ProcessHelper.scala:101)
    seed.process.ProcessHandler.onExit(ProcessHelper.scala:30)
    com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:310)
    com.zaxxer.nuprocess.osx.ProcessKqueue.processEvent(ProcessKqueue.java:314)
    com.zaxxer.nuprocess.osx.ProcessKqueue.process(ProcessKqueue.java:224)
    com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:78)
    java.lang.Thread.run(Thread.java:748)

I'm guessing this happens due to me running MacOS, but I'm not sure.

tindzk commented 5 years ago

It appears that on your machine /tmp is a symbolic link pointing to /private/tmp. I will change the tests to use a path within the current working directory instead. This will be more portable.

megri commented 5 years ago

That's funny, I've never realised MacOS symlinks these directories (it does the same with /etc and /var). That explains why the path-test fails. Perhaps it'd be an alternative to use stuff like java.io.File#createTempFile() instead of designating "/tmp" by name

tindzk commented 5 years ago

Interesting. I was not aware of this either. What does createTempDirectory return on macOS? I am getting this on Linux:

scala> java.nio.file.Files.createTempDirectory("seed")
res11: java.nio.file.Path = /tmp/seed892158896148301201

Also, as per your suggestion on Gitter, we should not build within the repository such that after running the tests, git status will not report any new files.