Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: mojo/edk/mojo_edk.gni

Issue 1417223005: EDK: Add mojo_edk_{unit,perf}tests target types. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/mojo_edk.gni
diff --git a/mojo/edk/mojo_edk.gni b/mojo/edk/mojo_edk.gni
index 21ad315a96af5baa5633da398007f87e850b57f9..6fbaafc97735a477e602c9415c6ae471f43680be 100644
--- a/mojo/edk/mojo_edk.gni
+++ b/mojo/edk/mojo_edk.gni
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("../public/mojo_sdk.gni")
+import("//testing/test.gni")
# A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict
# external dependencies and understands the following additional variables, all
@@ -96,6 +97,78 @@ template("mojo_edk_source_set") {
}
}
+template("mojo_edk_unittests") {
+ test(target_name) {
+ deps = [
+ rebase_path("mojo/edk/system/test:run_all_unittests", ".", mojo_root),
+ ]
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+ if (defined(invoker.deps)) {
+ foreach(dep, invoker.deps) {
+ # The only deps that are not specified relative to the location of the
+ # Mojo EDK should be on targets within the same file or on a whitelisted
+ # set of external dependencies.
+ # TODO(vtl): Get rid of //base dependencies (and stop allowing it).
+ assert(get_path_info(dep, "dir") == "." || dep == "//testing/gtest" ||
+ dep == "//base")
+ deps += [ dep ]
+ }
+ }
+ if (defined(invoker.mojo_sdk_deps)) {
+ foreach(sdk_dep, invoker.mojo_sdk_deps) {
+ # Check that the SDK dep was not mistakenly given as an absolute path.
+ assert(get_path_info(sdk_dep, "abspath") != sdk_dep)
+ deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
+ }
+ }
+ if (defined(invoker.mojo_edk_deps)) {
+ foreach(edk_dep, invoker.mojo_edk_deps) {
+ # Check that the EDK dep was not mistakenly given as an absolute path.
+ assert(get_path_info(edk_dep, "abspath") != edk_dep)
+ deps += [ rebase_path(edk_dep, ".", mojo_root) ]
+ }
+ }
+ }
+}
+
+template("mojo_edk_perftests") {
+ test(target_name) {
+ deps = [
+ rebase_path("mojo/edk/system/test:run_all_perftests", ".", mojo_root),
+ ]
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+ if (defined(invoker.deps)) {
+ foreach(dep, invoker.deps) {
+ # The only deps that are not specified relative to the location of the
+ # Mojo EDK should be on targets within the same file or on a whitelisted
+ # set of external dependencies.
+ # TODO(vtl): Get rid of //base dependencies (and stop allowing it).
+ assert(get_path_info(dep, "dir") == "." || dep == "//testing/gtest" ||
+ dep == "//base")
+ deps += [ dep ]
+ }
+ }
+ if (defined(invoker.mojo_sdk_deps)) {
+ foreach(sdk_dep, invoker.mojo_sdk_deps) {
+ # Check that the SDK dep was not mistakenly given as an absolute path.
+ assert(get_path_info(sdk_dep, "abspath") != sdk_dep)
+ deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
+ }
+ }
+ if (defined(invoker.mojo_edk_deps)) {
+ foreach(edk_dep, invoker.mojo_edk_deps) {
+ # Check that the EDK dep was not mistakenly given as an absolute path.
+ assert(get_path_info(edk_dep, "abspath") != edk_dep)
+ deps += [ rebase_path(edk_dep, ".", mojo_root) ]
+ }
+ }
+ }
+}
+
# Build EDK things with static thread annotation analysis enabled.
# TODO(vtl): Should we set this at a higher level?
if (is_clang) {
« no previous file with comments | « no previous file | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698