Yeah, I'm not happy with the tests myself, but I couldn't figure out how to make them any better (FIleCheck doesn't replace %s, etc). I'm completely unfamiliar with the clang test stuff, so if anyone can suggest a way to improve these please let me know.
On Wed, Oct 8, 2014 at 10:24 PM, Justin Bogner <[email protected]> wrote: > Dan Albert <[email protected]> writes: > > When building with coverage, -no-integrated-as, and -c, the driver was > > emitting -cc1 -coverage-file pointing at a file in /tmp. Ensure the > > coverage file is emitted in the same directory as the output file. > > LGTM, but some tests that involve relative paths would be nice. > > > http://reviews.llvm.org/D5697 > > > > Files: > > lib/Driver/Tools.cpp > > test/Driver/clang_f_opts.c > > > > Index: lib/Driver/Tools.cpp > > =================================================================== > > --- lib/Driver/Tools.cpp > > +++ lib/Driver/Tools.cpp > > @@ -3241,7 +3241,13 @@ > > C.getArgs().hasArg(options::OPT_S)) { > > if (Output.isFilename()) { > > CmdArgs.push_back("-coverage-file"); > > - SmallString<128> CoverageFilename(Output.getFilename()); > > + SmallString<128> CoverageFilename; > > + Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o); > > + if (FinalOutput) { > > + CoverageFilename = FinalOutput->getValue(); > > + } else { > > + CoverageFilename = > llvm::sys::path::filename(Output.getBaseInput()); > > + } > > if (llvm::sys::path::is_relative(CoverageFilename.str())) { > > SmallString<128> Pwd; > > if (!llvm::sys::fs::current_path(Pwd)) { > > Index: test/Driver/clang_f_opts.c > > =================================================================== > > --- test/Driver/clang_f_opts.c > > +++ test/Driver/clang_f_opts.c > > @@ -66,6 +66,18 @@ > > // CHECK-PROFILE-ARCS: "-femit-coverage-data" > > // CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data" > > > > +// RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck > -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s > > +// RUN: %clang -### -S -fprofile-arcs -no-integrated-as %s 2>&1 | > FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s > > +// RUN: %clang -### -c -fprofile-arcs %s 2>&1 | FileCheck > -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s > > +// RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s 2>&1 | > FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s > > +// RUN: %clang -### -S -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck > -check-prefix=CHECK-GCNO-LOCATION %s > > +// RUN: %clang -### -S -fprofile-arcs -no-integrated-as %s -o > /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s > > +// RUN: %clang -### -c -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck > -check-prefix=CHECK-GCNO-LOCATION %s > > +// RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s -o > /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s > > +// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-file" "{{.*}}/clang_f_opts.c" > > +// CHECK-GCNO-DEFAULT-LOCATION-NOT: "-coverage-file" > "/tmp/{{.*}}/clang_f_opts.c" > > +// CHECK-GCNO-LOCATION: "-coverage-file" "/foo/bar.o" > > + > > // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck > -check-prefix=CHECK-VECTORIZE %s > > // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck > -check-prefix=CHECK-VECTORIZE %s > > // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck > -check-prefix=CHECK-NO-VECTORIZE %s > > _______________________________________________ > > cfe-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
