diff --git a/docs/diff_test.md b/docs/diff_test.md index de63d9d5b..c4038fbd5 100644 --- a/docs/diff_test.md +++ b/docs/diff_test.md @@ -14,7 +14,7 @@ command (fc.exe) on Windows (no Bash is required). ## diff_test
-diff_test(name, file1, file2, size, timeout, kwargs)
+diff_test(name, file1, file2, size, kwargs)
 
A test that compares two files. @@ -30,8 +30,7 @@ The test succeeds if the files' contents match. | name | The name of the test rule. | none | | file1 | Label of the file to compare to <code>file2</code>. | none | | file2 | Label of the file to compare to <code>file1</code>. | none | -| size | standard attribute for tests | None | -| timeout | standard attribute for tests. Defaults to "short" if both timeout and size are unspecified. | None | +| size | standard attribute for tests | "small" | | kwargs | The <a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests">common attributes for tests</a>. | none | diff --git a/docs/testing.md b/docs/testing.md index e2c543682..74a31425b 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -29,7 +29,7 @@ Assert that an archive file contains at least the given file entries. ## assert_contains
-assert_contains(name, actual, expected, size, timeout, kwargs)
+assert_contains(name, actual, expected, size, kwargs)
 
Generates a test target which fails if the file doesn't contain the string. @@ -45,8 +45,7 @@ Depends on bash, as it creates an sh_test target. | name | target to create | none | | actual | Label of a file | none | | expected | a string which should appear in the file | none | -| size | the size attribute of the test target | None | -| timeout | the timeout attribute of the test target | None | +| size | standard attribute for tests | "small" | | kwargs | additional named arguments for the resulting sh_test | none | diff --git a/lib/private/diff_test.bzl b/lib/private/diff_test.bzl index 68d0b951c..e1ea14ee6 100644 --- a/lib/private/diff_test.bzl +++ b/lib/private/diff_test.bzl @@ -21,7 +21,6 @@ The rule uses a Bash command (diff) on Linux/macOS/non-Windows, and a cmd.exe command (fc.exe) on Windows (no Bash is required). """ -load("//lib:utils.bzl", "default_timeout") load(":directory_path.bzl", "DirectoryPathInfo") def _runfiles_path(f): @@ -107,7 +106,7 @@ _diff_test = rule( implementation = _diff_test_impl, ) -def diff_test(name, file1, file2, size = None, timeout = None, **kwargs): +def diff_test(name, file1, file2, size = "small", **kwargs): """A test that compares two files. The test succeeds if the files' contents match. @@ -117,15 +116,12 @@ def diff_test(name, file1, file2, size = None, timeout = None, **kwargs): file1: Label of the file to compare to file2. file2: Label of the file to compare to file1. size: standard attribute for tests - timeout: standard attribute for tests. Defaults to "short" if both timeout and size are unspecified. **kwargs: The common attributes for tests. """ - _diff_test( name = name, file1 = file1, file2 = file2, size = size, - timeout = default_timeout(size, timeout), **kwargs ) diff --git a/lib/private/write_source_file.bzl b/lib/private/write_source_file.bzl index f5e85d2ec..c2b2a5c53 100644 --- a/lib/private/write_source_file.bzl +++ b/lib/private/write_source_file.bzl @@ -122,6 +122,7 @@ To create an update *only* this file, run: message = message, visibility = kwargs.get("visibility"), tags = kwargs.get("tags"), + size = "small", ) else: if suggested_update_target == None: diff --git a/lib/testing.bzl b/lib/testing.bzl index 1b6feb2e9..d50821881 100644 --- a/lib/testing.bzl +++ b/lib/testing.bzl @@ -5,9 +5,8 @@ load("@bazel_skylib//rules:write_file.bzl", "write_file") load("//lib:diff_test.bzl", "diff_test") load("//lib:jq.bzl", "jq") load("//lib:params_file.bzl", "params_file") -load("//lib:utils.bzl", "default_timeout") -def assert_contains(name, actual, expected, size = None, timeout = None, **kwargs): +def assert_contains(name, actual, expected, size = "small", **kwargs): """Generates a test target which fails if the file doesn't contain the string. Depends on bash, as it creates an sh_test target. @@ -16,8 +15,7 @@ def assert_contains(name, actual, expected, size = None, timeout = None, **kwarg name: target to create actual: Label of a file expected: a string which should appear in the file - size: the size attribute of the test target - timeout: the timeout attribute of the test target + size: standard attribute for tests **kwargs: additional named arguments for the resulting sh_test """ @@ -45,7 +43,6 @@ def assert_contains(name, actual, expected, size = None, timeout = None, **kwarg srcs = [test_sh], args = ["$(rootpath %s)" % expected_file, "$(rootpath %s)" % actual], size = size, - timeout = default_timeout(size, timeout), data = [actual, expected_file], **kwargs ) diff --git a/lib/tests/write_source_files/write_source_file_test.bzl b/lib/tests/write_source_files/write_source_file_test.bzl index 0bebe6c13..d24206701 100644 --- a/lib/tests/write_source_files/write_source_file_test.bzl +++ b/lib/tests/write_source_files/write_source_file_test.bzl @@ -172,7 +172,7 @@ _write_source_file_test = rule( test = True, ) -def write_source_file_test(name, in_file, out_file, check_that_out_file_exists = True): +def write_source_file_test(name, in_file, out_file, check_that_out_file_exists = True, size = "small"): """Stamp a write_source_files executable and a test to run against it""" _write_source_file( @@ -190,5 +190,5 @@ def write_source_file_test(name, in_file, out_file, check_that_out_file_exists = write_source_file_target = name + "_updater", in_file = in_file, out_file = out_file, - timeout = "short", + size = size, )