mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-12-03 02:52:58 +00:00
43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
diff --git a/rules/diff_test.bzl b/rules/diff_test.bzl
|
|
index 71faf40..acde2ea 100644
|
|
--- a/rules/diff_test.bzl
|
|
+++ b/rules/diff_test.bzl
|
|
@@ -58,7 +58,7 @@ if "!RF2!" equ "" (
|
|
fc.exe 2>NUL 1>NUL /B "!RF1!" "!RF2!"
|
|
if %ERRORLEVEL% neq 0 (
|
|
if %ERRORLEVEL% equ 1 (
|
|
- echo>&2 FAIL: files "{file1}" and "{file2}" differ
|
|
+ echo>&2 FAIL: files "{file1}" and "{file2}" differ. {fail_msg}
|
|
exit /b 1
|
|
) else (
|
|
fc.exe /B "!RF1!" "!RF2!"
|
|
@@ -66,6 +66,7 @@ if %ERRORLEVEL% neq 0 (
|
|
)
|
|
)
|
|
""".format(
|
|
+ fail_msg = ctx.attr.failure_message,
|
|
file1 = _runfiles_path(ctx.file.file1),
|
|
file2 = _runfiles_path(ctx.file.file2),
|
|
),
|
|
@@ -95,10 +96,11 @@ else
|
|
exit 1
|
|
fi
|
|
if ! diff "$RF1" "$RF2"; then
|
|
- echo >&2 "FAIL: files \"{file1}\" and \"{file2}\" differ"
|
|
+ echo >&2 "FAIL: files \"{file1}\" and \"{file2}\" differ. {fail_msg}"
|
|
exit 1
|
|
fi
|
|
""".format(
|
|
+ fail_msg = ctx.attr.failure_message,
|
|
file1 = _runfiles_path(ctx.file.file1),
|
|
file2 = _runfiles_path(ctx.file.file2),
|
|
),
|
|
@@ -112,6 +114,7 @@ fi
|
|
|
|
_diff_test = rule(
|
|
attrs = {
|
|
+ "failure_message": attr.string(),
|
|
"file1": attr.label(
|
|
allow_single_file = True,
|
|
mandatory = True,
|