Skip to content

Commit

Permalink
[engine] Fix test failure on Mac
Browse files Browse the repository at this point in the history
Some of these tests were failing on Mac saying that the specified files
weren't actually under the root. See comment for explanation.

Change-Id: Ibccf6e000afea42337bbabac5cba2de8499efc32
Reviewed-on: https://fuchsia-review.googlesource.com/c/shac-project/shac/+/911233
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Anthony Fandrianto <atyfto@google.com>
Fuchsia-Auto-Submit: Oliver Newman <olivernewman@google.com>
  • Loading branch information
orn688 authored and CQ Bot committed Sep 1, 2023
1 parent 5795d43 commit e5815f1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/engine/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ func TestRun_SpecificFiles(t *testing.T) {
// Not parallelized because it calls os.Chdir.

root := t.TempDir()

// Evaluate symlinks so that tests work on Mac, where t.TempDir() returns
// path under /var, but /var is symlinked to /private/var and os.Getwd()
// returns the path with symlinks resolved.
root, err := filepath.EvalSymlinks(root)
if err != nil {
t.Fatal(err)
}

writeFile(t, root, "shac.textproto", prototext.Format(&Document{
Ignore: []string{
// Specifying files on the command line should override ignores.
Expand Down

0 comments on commit e5815f1

Please sign in to comment.