Skip to content

Commit ec57ad7

Browse files
[SYCL][E2E] Track amount of XFAILed tests (#15603)
We have a problem with our approach to `XFAIL`ing failed tests - we don't always submit trackers for those failures, thus simply hiding them from us. Some of tests we `XFAIL`ed have been in that state for years and without a tracker submitted about them, we don't even know that there are issues. This patch introduces a new requirement for marking test as expected to fail: every `XFAIL` directive has to be followed by `XFAIL-TRACKER` which points to a public or internal issue submitted to analyze the failure and remove `XFAIL` directive. To ensure that the new requirement is followed, a new test was added which checks amount of improper `XFAIL` directives (i.e. those which are not followed by `XFAIL-TRACKER` directive). Similar approach is expected to be applied later for `UNSUPPORTED` directives, but it will be done as a separate PR. --------- Co-authored-by: Marcos Maronas <marcos.maronas@intel.com>
1 parent c9e4676 commit ec57ad7

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

sycl/test-e2e/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,27 @@ implementation header files is still in progress and the final set of these
320320
"fine-grained" includes that might be officially documented and suggested for
321321
customers to use isn't determined yet. **Until then, code outside of this project
322322
must keep using `<sycl/sycl.hpp>` provided by the SYCL2020 specification.**
323+
324+
## Marking tests as expected to fail
325+
326+
Every test should be written in a way that it is either passed, or it is skipped
327+
(in case it is not compatible with an environment it was launched in).
328+
329+
If for any reason you find yourself in need to temporary mark test as expected
330+
to fail under certain conditions, you need to submit an issue to the repo to
331+
analyze that failure and make test passed or skipped.
332+
333+
Once the issue is created, you can update the test by adding `XFAIL` and
334+
`XFAIL-TRACKER` directive:
335+
```
336+
// GPU driver update caused failure
337+
// XFAIL: level_zero
338+
// XFAIL-TRACKER: PRJ-5324
339+
340+
// Sporadically fails on CPU:
341+
// XFAIL: cpu
342+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/DDDDD
343+
```
344+
345+
If you add `XFAIL` without `XFAIL-TRACKER` directive,
346+
`no-xfail-without-tracker.cpp` test will fail, notifying you about that.

sycl/test-e2e/Sampler/normalized-clampedge-linear-float.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %{build} -o %t.out
44
// RUN: %{run} %t.out
55
// XFAIL: hip
6+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/14732
67

78
// CUDA works with image_channel_type::fp32, but not with any 8-bit per channel
89
// type (such as unorm_int8)

sycl/test-e2e/Sampler/normalized-clampedge-nearest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Missing __spirv_ImageWrite, __spirv_SampledImage,
66
// __spirv_ImageSampleExplicitLod on AMD
77
// XFAIL: hip_amd
8+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/14732
89

910
/*
1011
This file sets up an image, initializes it with data,
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// This test is intended to ensure that we have no trackers marked as XFAIL
2+
// without a tracker information added to a test.
3+
//
4+
// The format we check is:
5+
// XFAIL: lit,features
6+
// XFAIL-TRACKER: [GitHub issue URL|Internal tracker ID]
7+
//
8+
// GitHub issue URL format:
9+
// https://github.com/owner/repo/issues/12345
10+
//
11+
// Internal tracker ID format:
12+
// PROJECT-123456
13+
//
14+
// REQUIRES: linux
15+
//
16+
// Explanation of the command:
17+
// - search for all "XFAIL" occurrences, display line with match and the next one
18+
// -I, --include to drop binary files and other unrelated files
19+
// - in the result, search for "XFAIL" again, but invert the result - this
20+
// allows us to get the line *after* XFAIL
21+
// - in those lines, check that XFAIL-TRACKER is present and correct. Once
22+
// again, invert the search to get all "bad" lines
23+
// - make a final count of how many ill-formatted directives there are and
24+
// verify that against the reference
25+
//
26+
// RUN: grep -rI "XFAIL:" %S -A 1 --include=*.c --include=*.cpp \
27+
// RUN: --no-group-separator | \
28+
// RUN: grep -v "XFAIL:" | \
29+
// RUN: grep -Pv "XFAIL-TRACKER:\s+(?:https://github.com/[\w\d-]+/[\w\d-]+/issues/[\d]+)|(?:[\w]+-[\d]+)" | \
30+
// RUN: wc -l | FileCheck %s --check-prefix NUMBER-OF-XFAIL-WITHOUT-TRACKER
31+
//
32+
// The number below is a number of tests which are *improperly* XFAIL-ed, i.e.
33+
// we either don't have a tracker associated with a failure listed in those
34+
// tests, or it is listed in a wrong format.
35+
// Note: strictly speaking, that is not amount of files, but amount of XFAIL
36+
// directives. If a test contains several XFAIL directives, some of them may be
37+
// valid and other may not.
38+
//
39+
// That number *must not* increase. Any PR which causes this number to grow
40+
// should be rejected and it should be updated to either keep the number as-is
41+
// or have it reduced (preferrably, down to zero).
42+
//
43+
// If you see this test failed for your patch, it means that you either
44+
// introduced XFAIL directive to a test improperly, or broke the format of an
45+
// existing XFAIL-ed tests.
46+
// Another possibility (and that is a good option) is that you updated some
47+
// tests to match the required format and in that case you should just update
48+
// (i.e. reduce) the number below.
49+
//
50+
// NUMBER-OF-XFAIL-WITHOUT-TRACKER: 187

0 commit comments

Comments
 (0)