Sometimes, autotest will run the test even though the
build fails. This occurs when a gn file is modified
before running autotest.py.
This change ensures that the test is not run when
the build fails.
Change-Id: I6ed35e83f02ee59697030c466c500202aa8536f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2898147
Auto-Submit: Dan H <harringtond@chromium.org>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883121}
Implements the intent sender validation, and satisfies the module's API
contract. Follwup changes will make use of the data the sender sends.
Also, this code isn't hooked up to the LaunchIntentDispatcher yet, that
will come in a followup.
I've chosen to use a MAC on the intent to validate the creator of the
intent sent by the received PendingIntent in order to avoid
complexities around static state. Replay attacks etc. aren't really a
concern as only the original PendingIntent sender could replay the
Intent - but they don't gain anything from being able to replay
messages as they can already just send anything they want. Future CLs
will implement things like rate-limiting, input validation, etc. to
help avoid abuse of this API.
Explainer:
https://github.com/WICG/conversion-measurement-api/blob/main/app_to_web.md
Bug: 1198308
Change-Id: I6f1e9eb079f41b27cdb9e4ee85b2f22c2266d813
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2860466
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879004}
Autotest checks for gtest files to better determine if a give file is
actually a test file or not. However, because many files don't actually
include what they use, many test files don't directly include gtest.h,
gmock.h, or a test_utils.h file. Instead, they may include those via
something like sim_test.h, resulting in the script ignoring those files
right now.
This change improves that by still looking for files that include a
gtest file, but until it has found at least one file that does, it
will also collect files that match the test file name regex and do not
match the gtest include regex. Then, if no files are found with the
gtest includes, it will move forward under the assumption that the
file it found without the gtest include was the correct test file.
It will still prefer files with gtest includes, but has a fallback in
case none exist, providing a best effort chance at building and
running the tests.
Also includes a small improvement to outputting the file names that
it finds after a recursive file search.
Change-Id: Ia56792426b55cb17a43ffe2545b4deefb5dba0dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568710
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832607}
This CL includes several improvements to autotest.py:
-Slightly expand the GTest regex.
-Previously, it missed some tests due to them not explicitly including
gtest via #include "...gtest.h". Variations included <...gtest.h>,
gmock.h, or via *test_utils.h. Expand the regex to include these
cases.
-In my (limited) testing I didn't see any large regressions in terms
of number of files added via the expanded regex, but its possible
there is something I missed.
-Add utf-8 encoding when opening a file to read.
-This avoids errors when opening files with non-English characters.
-Debugging lines to output all files that matched the regex.
-Added sys.executable to beginning of call to make-gtest-filter.py.
-This enables it to work on Windows, which requires 'python3' before
calling a python script.
Change-Id: Ic9e67658b7298867d997ba4cc396320bf5d61c8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517944
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#824031}
Use autoninja from PATH so that it matches the version used when
building explicitly (allows for devs that are using a custom-built
version of ninja).
Allow omitting -C when script is run from within the output directory.
This matches ninja's behavior.
Bug: None
Change-Id: I55763f178e2cf85892efbb4397a7ec81ed054aa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419608
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808875}
* > autotest ... base/strings/strcat.cc
will now run tests for base/strings/strcat_unittest.cc
* > autotest ... strcat
no longer complains "strcat" is ambiguous, since strcat_unittest.cc is
the only matching test file.
* Fixed rare case where caching could use the wrong
target.
Change-Id: Id028b8d5477687bef02b6cd94688f74839d08964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2407857
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807479}
- Use make-gtest-filter.py to build a gtest filter automatically.
- Allow testing a full directory.
- --run-all: allow testing multiple targets in one run, instead of
asking the user to pick.
- Speed it up if a file path is specified, by skipping the file
search.
- Cache gn refs output, to make follow-up runs faster.
- Add --line option, to run a test at specific line number.
- Change call to ninja build so that output is streamed
- Switch to printing errors end then exiting for non-exceptional errors.
This makes user errors more readable.
Change-Id: Ib3660123f5a7fe5c3ef3369d360c3ea3218d233a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391209
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804987}
Currently, autotest.py doesn't support the forward slash '/' as a path
separator on Windows. For example:
Succeeds:
python3 tools/autotest.py -C out/bug base\at_exit_unittest
--gtest_filter=*Exit*
Fails:
python3 tools/autotest.py -C out/bug base/at_exit_unittest
--gtest_filter=*Exit*
This is because RecursiveMatchFilename() considers a file a match with
the requested filename if the requested filename is a substring of the
file's full path. On Windows, file paths as returned by os.scandir()
use '\\' as a path separator, so a path using '/' will never match
(e.g. 'base/at_exit_unittest' is not a substring of
'C:\\src\\chromium\\src\\base\\at_exit_unittest.cc').
With this change, either type of path separator works on Windows.
Change-Id: Ic21eff291d86e7ca994faeda807f6aeaff737562
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181744
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766500}
tools/autotest.py currently uses `"win" in sys.platform` to detect if
the current platform is Windows. macOS uses "darwin" as the platform, so
this check erroneously detects macOS as Windows.
According to the documentation for sys.platform, the platform value
should be matched against sys.platform as a prefix:
https://docs.python.org/3/library/sys.html#sys.platform
This change tightens the check to only detect platforms starting with
"win32" as Windows.
R=mthiesse
Change-Id: Ic46cbc3b28c250d6557a58f583d5a9ba03df5b6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134964
Auto-Submit: K Moon <kmoon@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756079}
Uses gn refs to find the test target containing the file, then builds
and runs the suite. For java test files the filter can be automatically
generated, but for c++ it isn't as straightforward so I've made the
filter mandatory.
./tools/autotest.py -C out/Desktop image_decoder_browsertest.cc --gtest_filter="ImageDecoder"
./tools/autotest.py -C out/Android UrlUtilitiesUnitTest --fast-local-dev -v
Examples:
Change-Id: I1840ef3634e4a011f871acd973d5f8bb5038c3a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2101542
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752515}