aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/compiler_wrapper_test.go
AgeCommit message (Collapse)Author
2021-06-18compiler_wrapper: fix flaky testsGeorge Burgess IV
We're running many tests in parallel that have dependencies on the `umask` global. We shouldn't be running these in parallel with each other, since they may read values for this that're set by other goroutines. Since these are difficult to spot, this CL does two things: - Requiring that all tests mark themselves as either readers of or writers to umask. Any test that does this gets run in serial with other tests that do it. - Requires code that modifies/reads the umask to go through `env.umask`, rather than `syscall.Umask`. This allows us to cheaply and accurately verify that a test's dependency on the process' umask was stated. BUG=b:186801841 TEST=`go test -count=100` passed Change-Id: Ifa871cfa48c005646499b21c1bfa1a4799ca641b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2956692 Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-04-21compiler_wrapper: disable rusage when goma enabledRyan Beltran
This disables rusage logging when Goma is enabled as goma makes the resulting logs meaningless. BUG=None TEST=Updated and ran go tests Change-Id: If55a820676faa6b40d471db48749d384b7e2c671 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2840684 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Ryan Beltran <ryanbeltran@chromium.org>
2021-01-29compiler_wrapper: disable force-disable-werror with GCCGeorge Burgess IV
Enabling this functionality with GCC is pointless -- we don't roll it, so we don't want to catch new -Werrors with it. We're having some GCC-specific functionality coming in soon; disabling this simplifies things some. BUG=chromium:1166017 TEST=CQ Change-Id: I3f73a8124ea85a2f14fd5c909a9bbed2b46f28f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2648431 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-01-22compiler_wrapper: refactor rusage_flagRyan Beltran
Refactors rusage_flag and its usage in compiler_wrapper to support the use of TOOLCHAIN_RUSAGE_OUTPUT with either FORCE_DISABLE_WERROR. BUG=chromium:1167958 TEST=Modified and ran unit tests Change-Id: I9a643ceabbbeca3bf3a94270d4f4b4d814812f93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2635451 Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2020-12-16compiler_wrapper: rename GETRUSAGE flagRyan Beltran
GETRUSAGE has been renamed TOOLCHAIN_RUSAGE_OUTPUT for clarity. BUG=chromium:1156314 TEST=Reran unit tests for package main Change-Id: I4588b4138f0dd4e4938762250e5caa6b4026e3f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2594261 Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: Ryan Beltran <ryanbeltran@chromium.org>
2020-06-19wrapper: print android-llvm@ when using the Android wrapper.George Burgess IV
Otherwise, the wrapper might say: ``` Internal error. Please report to chromeos-toolchain@google.com. ``` to Android developers in some cases. BUG=b:159291805 TEST=`go test` Change-Id: I9a96068f02a2c6ce5e251c8754e267dfb1a30db1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2252553 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-03-05wrapper: correctly Join() paths for AndroidGeorge Burgess IV
filepath.Join(".", "foo") folds to "foo", which is fine as long as we're not Exec()ing the result of that Join(). If we do, we might execute a binary we weren't expecting to (e.g., one looked up from ${PATH}, rather than the one at ${CWD}). BUG=None TEST=`go test` Change-Id: Ifbd247c2e489c786d0a0d3342b5d1b61a7320796 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2088432 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2019-11-01toolchain_utils: Remove comparison to old wrapper from compiler_wrapper.Tobias Bosch
BUG=chromium:773875 TEST='go test' passes Change-Id: Iecbe15067bf37fd86fbb8a907d42df32288821d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1884701 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-08-20Forward os.Stdin to child processes.Tobias Bosch
BUG=chromium:773875 TEST=unit tests, build glibc with compiler wrapper Change-Id: I0b5c1f5adaee18499b72747cd6042b00a9d52c1d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1760973 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-07-22Support gcc host wrapper.Tobias Bosch
This change adds support for the gcc host wrapper. The implementation is verified via comparing to the old gcc host wrapper in the golden tests. BUG=chromium:773875 TEST=unit test Change-Id: I3af98b81dba6d9299183db01e967003be860972c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1710537 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-22Add license headers to all go files.Tobias Bosch
Required as of https://chromium.git.corp.google.com/chromiumos/repohooks/+/9732e38a5551e4bbcd222d2bbb89ee0fc5c95dee BUG=chromium:773875 TEST=unit test Change-Id: I8dfed85b0fbd528084ff2e585bbf3624ac358135 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1710404 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
2019-07-18Add json mapping for command and commandResult.Tobias Bosch
Also exports the fields on these structs so that json can read/write them. BUG=chromium:773875 TEST=unit test Change-Id: I0efead41693dd35548738a0b3a3e5c71c97c319c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1706790 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-07-12Add support for calling bisect driverTobias Bosch
Also removes forwarding to old wrapper as we now have all functionality in the new wrapper. BUG=chromium:773875 TEST=unit test, ran command for bisect driver manually in terminal. Change-Id: Icea8a20030bc72e46d6802934acd1d657f62d766 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1697929 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-07-11Support resource usage loggingTobias Bosch
BUG=chromium:773875 TEST=unit test Change-Id: Ifc0a7311b439e767dbb83bee350c210abbff54e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1695802 Reviewed-by: Tobias Bosch <tbosch@google.com> Tested-by: Tobias Bosch <tbosch@google.com>
2019-06-28Introduce infrastructure for calling and testing nestedTobias Bosch
commands, error messages and exit codes. Also: - implements the -Xclang-path= flag as use case of calling a nested command. - adds tests for forwarding errors, comparing against the old wrapper, and exit codes. - captures the source locations of errors in error messages. - compares exit codes of new wrapper and old wrapper. BUG=chromium:773875 TEST=unit test Change-Id: I919e58091d093d68939809f676f799a68ec7a34e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1676833 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com>
2019-06-20Initial version of a go version of the compiler wrapper.Tobias Bosch
Still calls the old wrapper if one of the following flags is given: - Xclang-path - clang-syntax - env WITH_TIDY - env FORCE_DISABLE_WERROR - env GETRUSAGE - env BISECT_STAGE BUG=chromium:773875 TEST=Unit tests that also verify the produced command against the TEST=existing compiler wrapper. Change-Id: I1e0a720ce9f485d8015deefb2682f2cb760d82e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1652057 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>