Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kselftest/arm64: signal: Allow tests to be incompatible with features

Some features may invalidate some tests, for example by supporting an
operation which would trap otherwise. Allow tests to list features that
they are incompatible with so we can cover the case where a signal will
be generated without disruption on systems where that won't happen.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220207152109.197566-6-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Mark Brown and committed by
Will Deacon
32de73e8 0a775ccb

+28 -9
+1
tools/testing/selftests/arm64/signal/test_signals.h
··· 53 53 char *name; 54 54 char *descr; 55 55 unsigned long feats_required; 56 + unsigned long feats_incompatible; 56 57 /* bitmask of effectively supported feats: populated at run-time */ 57 58 unsigned long feats_supported; 58 59 bool initialized;
+25 -9
tools/testing/selftests/arm64/signal/test_signals_utils.c
··· 36 36 { 37 37 size_t flen = MAX_FEATS_SZ - 1; 38 38 39 + feats_string[0] = '\0'; 40 + 39 41 for (int i = 0; i < FMAX_END; i++) { 40 42 if (feats & (1UL << i)) { 41 43 size_t tlen = strlen(feats_names[i]); ··· 258 256 td->minsigstksz = MINSIGSTKSZ; 259 257 fprintf(stderr, "Detected MINSTKSIGSZ:%d\n", td->minsigstksz); 260 258 261 - if (td->feats_required) { 259 + if (td->feats_required || td->feats_incompatible) { 262 260 td->feats_supported = 0; 263 261 /* 264 262 * Checking for CPU required features using both the ··· 269 267 if (getauxval(AT_HWCAP) & HWCAP_SVE) 270 268 td->feats_supported |= FEAT_SVE; 271 269 if (feats_ok(td)) { 272 - fprintf(stderr, 273 - "Required Features: [%s] supported\n", 274 - feats_to_string(td->feats_required & 275 - td->feats_supported)); 270 + if (td->feats_required & td->feats_supported) 271 + fprintf(stderr, 272 + "Required Features: [%s] supported\n", 273 + feats_to_string(td->feats_required & 274 + td->feats_supported)); 275 + if (!(td->feats_incompatible & td->feats_supported)) 276 + fprintf(stderr, 277 + "Incompatible Features: [%s] absent\n", 278 + feats_to_string(td->feats_incompatible)); 276 279 } else { 277 - fprintf(stderr, 278 - "Required Features: [%s] NOT supported\n", 279 - feats_to_string(td->feats_required & 280 - ~td->feats_supported)); 280 + if ((td->feats_required & td->feats_supported) != 281 + td->feats_supported) 282 + fprintf(stderr, 283 + "Required Features: [%s] NOT supported\n", 284 + feats_to_string(td->feats_required & 285 + ~td->feats_supported)); 286 + if (td->feats_incompatible & td->feats_supported) 287 + fprintf(stderr, 288 + "Incompatible Features: [%s] supported\n", 289 + feats_to_string(td->feats_incompatible & 290 + ~td->feats_supported)); 291 + 292 + 281 293 td->result = KSFT_SKIP; 282 294 return 0; 283 295 }
+2
tools/testing/selftests/arm64/signal/test_signals_utils.h
··· 18 18 19 19 static inline bool feats_ok(struct tdescr *td) 20 20 { 21 + if (td->feats_incompatible & td->feats_supported) 22 + return false; 21 23 return (td->feats_required & td->feats_supported) == td->feats_required; 22 24 } 23 25