benchtests: Add UNSUPPORTED benchmark status
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 29 Apr 2022 05:36:00 +0000 (11:06 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 29 Apr 2022 06:18:16 +0000 (11:48 +0530)
The libmvec benchmarks print a message indicating that a certain CPU
feature is unsupported and exit prematurelyi, which breaks the JSON in
bench.out.

Handle this more elegantly in the bench makefile target by adding
support for an UNSUPPORTED exit status (77) so that bench.out continues
to have output for valid tests.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
benchtests/Makefile
sysdeps/x86_64/fpu/bench-libmvec-skeleton.c

index b477042..7943d1c 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (C) 2013-2022 Free Software Foundation, Inc.
+# Copyright The GNU Toolchain Authors.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -417,11 +418,23 @@ bench-func: $(binaries-bench)
          echo "{\"timing_type\": \"$${timing_type}\","; \
          echo " \"functions\": {"; \
          for run in $^; do \
-           if ! [ "x$${run}" = "x$<" ]; then \
-             echo ","; \
-           fi; \
-           echo "Running $${run}" >&2; \
-           $(run-bench) $(DETAILED_OPT); \
+           op=$$($(run-bench) $(DETAILED_OPT)); \
+           ret=$$?; \
+           case "$${ret}" in \
+             77) \
+             echo "UNSUPPORTED $${run}: $${op}" >&2; \
+               ;; \
+             0) \
+               echo "Running $${run}" >&2; \
+               if [ "$${run}" != "$<" ]; then \
+                 echo ","; \
+               fi; \
+               echo "$${op}"; \
+               ;; \
+             *) \
+               echo "FAILED $${run}" >&2; \
+               ;; \
+           esac; \
          done; \
          echo; \
          echo " }"; \
index 8954abe..e28249d 100644 (file)
@@ -40,20 +40,20 @@ main (int argc, char **argv)
 #if defined REQUIRE_AVX
   if (!CPU_FEATURE_ACTIVE (AVX))
     {
-      printf ("AVX not supported.\n");
-      return 0;
+      printf ("AVX not supported.");
+      return 77;
     }
 #elif defined REQUIRE_AVX2
   if (!CPU_FEATURE_ACTIVE (AVX2))
     {
-      printf ("AVX2 not supported.\n");
-      return 0;
+      printf ("AVX2 not supported.");
+      return 77;
     }
 #elif defined REQUIRE_AVX512F
   if (!CPU_FEATURE_ACTIVE (AVX512F))
     {
-      printf ("AVX512F not supported.\n");
-      return 0;
+      printf ("AVX512F not supported.");
+      return 77;
     }
 #endif