Skip to content

Commit

Permalink
Fix broken serve tests on macOS (rojo-rbx#824)
Browse files Browse the repository at this point in the history
Right now, serve tests will fail when Rojo is built with the FSEvent
backend. The cause is essentially due to the fact that `/var` (where
temporary directories for serve tests are located) on macOS is actually
a symlink to `/private/var`. Paths coming from FSEvent always have
symlinks expanded, but Rojo never expands symlinks. So, Rojo's paths
during these tests look like `/var/*` while the FSEvent paths look like
`/private/var/*`. When Rojo's change processor receives these events, it
considers them outside the project and does not apply any changes,
causing serve tests to time out.

To work around this, we can call `Path::canonicalize` before passing the
project path to `rojo serve` during serve tests. Rojo does need to
better support symlinks (which would also solve the problem), but I
think that can be left for another day because it's larger in scope and
I mostly just want working tests before addressing rojo-rbx#609.
  • Loading branch information
kennethloeffler authored Dec 28, 2023
1 parent 23327cb commit 96987af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/rojo_test/serve_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ impl TestServeSession {

let source_path = Path::new(SERVE_TESTS_PATH).join(name);
let dir = tempdir().expect("Couldn't create temporary directory");
let project_path = dir.path().join(name);
let project_path = dir
.path()
.canonicalize()
.expect("Couldn't canonicalize temporary directory path")
.join(name);

let source_is_file = fs::metadata(&source_path).unwrap().is_file();

Expand Down

0 comments on commit 96987af

Please sign in to comment.