Skip to main content
Version: 1.5.x

diff_test

A test rule that compares two binary files.

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).

Macros and Functions

diff_test

A test that compares two files.

The test succeeds if the files' contents match.

Example usage (generated):

load("@bazel_skylib//rules:diff_test.bzl", "diff_test")

diff_test(
# The name of the test rule.
name = "",
# Label of the file to compare to `file2`.
file1 = None,
# Label of the file to compare to `file1`.
file2 = None,
)

name

Required.

The name of the test rule.

file1

Required.

Label of the file to compare to file2.

file2

Required.

Label of the file to compare to file1.

failure_message

Optional. Default: None

Additional message to log if the files' contents do not match.

kwargs

Optional.

The common attributes for tests.