-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into windows-pdb
- Loading branch information
Showing
16 changed files
with
167 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
load(":disable_custom_test_launcher_test.bzl", "disable_custom_test_launcher_test_suite") | ||
|
||
disable_custom_test_launcher_test_suite( | ||
name = "disable_custom_test_launcher_test_suite", | ||
) |
83 changes: 83 additions & 0 deletions
83
test/unit/disable_custom_test_launcher/disable_custom_test_launcher_test.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"""Unittests for rust rules.""" | ||
|
||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("//rust:defs.bzl", "rust_test") | ||
|
||
def _incompatible_enable_custom_test_launcher_test_impl(ctx): | ||
env = analysistest.begin(ctx) | ||
tut = analysistest.target_under_test(env) | ||
|
||
executable = tut.files_to_run.executable | ||
asserts.true(env, executable.basename.endswith(".launcher") or executable.basename.endswith(".launcher.exe")) | ||
|
||
return analysistest.end(env) | ||
|
||
def _incompatible_disable_custom_test_launcher_test_impl(ctx): | ||
env = analysistest.begin(ctx) | ||
tut = analysistest.target_under_test(env) | ||
|
||
executable = tut.files_to_run.executable | ||
asserts.false(env, executable.basename.endswith(".launcher") or executable.basename.endswith(".launcher.exe")) | ||
|
||
return analysistest.end(env) | ||
|
||
incompatible_enable_custom_test_launcher_test = analysistest.make( | ||
_incompatible_enable_custom_test_launcher_test_impl, | ||
config_settings = { | ||
"@//rust/settings:incompatible_disable_custom_test_launcher": False, | ||
}, | ||
) | ||
|
||
incompatible_disable_custom_test_launcher_test = analysistest.make( | ||
_incompatible_disable_custom_test_launcher_test_impl, | ||
config_settings = { | ||
"@//rust/settings:incompatible_disable_custom_test_launcher": True, | ||
}, | ||
) | ||
|
||
def _disable_custom_test_launcher_test(): | ||
write_file( | ||
name = "src", | ||
out = "lib.rs", | ||
content = [], | ||
) | ||
|
||
write_file( | ||
name = "data", | ||
out = "data.txt", | ||
content = [], | ||
) | ||
|
||
rust_test( | ||
name = "disable_custom_test_launcher_test", | ||
srcs = [":lib.rs"], | ||
env = {"CUSTOM_TEST_ENV": "$(execpath :data)"}, | ||
data = [":data"], | ||
) | ||
|
||
incompatible_enable_custom_test_launcher_test( | ||
name = "incompatible_enable_custom_test_launcher_test", | ||
target_under_test = ":disable_custom_test_launcher_test", | ||
) | ||
|
||
incompatible_disable_custom_test_launcher_test( | ||
name = "incompatible_disable_custom_test_launcher_test", | ||
target_under_test = ":disable_custom_test_launcher_test", | ||
) | ||
|
||
def disable_custom_test_launcher_test_suite(name): | ||
"""Entry-point macro called from the BUILD file. | ||
Args: | ||
name: Name of the macro. | ||
""" | ||
_disable_custom_test_launcher_test() | ||
|
||
native.test_suite( | ||
name = name, | ||
tests = [ | ||
":incompatible_disable_custom_test_launcher_test", | ||
":incompatible_enable_custom_test_launcher_test", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub fn main() { | ||
println!("Hello"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters