Dedupe addition of crash-diagnostics-dir

For chromeos-chrome builds, we need to remove any unnecessary
{PVR} like info from the build cmd in order for cache hits across
builds.

chromeos-chrome already defines "crash_diagnostics-dir" in such a
manner, but compiler-wrapper adds a duplicate definition of this same
flag but with {PVR} like info.

The fix here is to update compiler-wrapper so that it does not add
"crash-diagnostics-dir" if it is already defined.

BUG=b:326847828
TEST=go test -vet=all (and added more tests)

Change-Id: I81c4dbb29241e85cf78659f35ac9dd93999b6b01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5321366
Tested-by: Eric Lok <lokeric@google.com>
Commit-Queue: Eric Lok <lokeric@google.com>
Auto-Submit: Eric Lok <lokeric@google.com>
Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Commit-Queue: Ryan Beltran <ryanbeltran@chromium.org>
Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
2 files changed