Skip to content

Commit

Permalink
Follow new guideline: Avoid cd DIR && FOO in RUN lines.
Browse files Browse the repository at this point in the history
Instead, put `FOO` on a separate run line. `cd` affects later RUN lines,
and `cd DIR && FOO` could mislead the reader that it doesn't and that's
why we needed to put both parts on one line. I added the proposed
guideline to #346.

I'm changing the existing tests before changing more tests to use `cd`
as part of this PR.
  • Loading branch information
mattmccutchen-cci committed Jun 21, 2021
1 parent 157e2cd commit 6983694
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions clang/test/3C/base_subdir/canwrite_constraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
// not allow canwrite_constraints.h to change, and the internal types of q and
// the return should remain wild.
//
// RUN: cd %S && 3c -alltypes -addcr -output-dir=%t.checked/base_subdir -warn-all-root-cause %s -- -Xclang -verify
// RUN: cd %S
// RUN: 3c -alltypes -addcr -output-dir=%t.checked/base_subdir -warn-all-root-cause %s -- -Xclang -verify
// RUN: FileCheck -match-full-lines -check-prefixes=CHECK_LOWER --input-file %t.checked/base_subdir/canwrite_constraints.c %s
// RUN: test ! -f %t.checked/canwrite_constraints.checked.h

// "Higher" case: When -base-dir is set to the parent directory, we can change
// canwrite_constraints.h, so both q and the return should become checked.
//
// RUN: cd %S && 3c -alltypes -addcr -base-dir=.. -output-dir=%t.checked2 %s --
// RUN: 3c -alltypes -addcr -base-dir=.. -output-dir=%t.checked2 %s --
// RUN: FileCheck -match-full-lines -check-prefixes=CHECK_HIGHER --input-file %t.checked2/base_subdir/canwrite_constraints.c %s
// RUN: FileCheck -match-full-lines -check-prefixes=CHECK_HIGHER --input-file %t.checked2/canwrite_constraints.h %S/../canwrite_constraints.h

Expand Down
3 changes: 2 additions & 1 deletion clang/test/3C/base_subdir/canwrite_constraints_symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
// Now 3C should know that it can't write to base_subdir_partial_defn.h because
// the symlink goes out of the base dir.
//
// RUN: cd %t.base && 3c -addcr canwrite_constraints_symlink.c -- -Xclang -verify
// RUN: cd %t.base
// RUN: 3c -addcr canwrite_constraints_symlink.c -- -Xclang -verify

// expected-error@base_subdir_partial_defn.h:1 {{3C internal error: 3C generated changes to this file even though it is not allowed to write to the file}}
// expected-note@*:* {{-dump-unwritable-changes}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// an error diagnostic.
// (https://github.com/correctcomputation/checkedc-clang/issues/387)

// RUN: cd %S && 3c -addcr %s -- -Xclang -verify
// RUN: cd %S
// RUN: 3c -addcr %s -- -Xclang -verify

// expected-error@../base_subdir_partial_defn.h:1 {{3C internal error: 3C generated changes to this file even though it is not allowed to write to the file}}
// expected-note@*:* {{-dump-unwritable-changes}}
Expand Down

0 comments on commit 6983694

Please sign in to comment.