]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Change s390-features to allow testing for absence of a feature.
authorFlorian Krohm <florian@eich-krohm.de>
Sun, 2 Sep 2012 03:30:38 +0000 (03:30 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sun, 2 Sep 2012 03:30:38 +0000 (03:30 +0000)
This is infintely less painful than to find out how to invert
the condition in a test prerequisite.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12928

none/tests/s390x/fpext_fail.vgtest
tests/s390x_features.c

index ce19676f7922c0d4c252a24c42feee7b65ea3ff9..64ed5ee90ba8a906e32a36a41fba2cc5d81be01c 100644 (file)
@@ -1,2 +1,2 @@
 prog: fpext
-prereq: test ! `../../../tests/s390x_features s390x-fpext`
+prereq: ../../../tests/s390x_features '!s390x-fpext'
index f2365bccc575f3036fbc2b223ea05c44215b6116..4dde355f2994ec8de2e27d421b6626cbb96fbe08 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <assert.h>
 #include <ctype.h>     // isspace
 #include <fcntl.h>     // open
 #include <unistd.h>    // lseek
@@ -296,14 +297,28 @@ static int go(char *feature, char *cpu)
 //---------------------------------------------------------------------------
 int main(int argc, char **argv)
 {
-   int rc;
+   int rc, inverted = 0;
 
    if (argc < 2 || argc > 3) {
       fprintf( stderr, "usage: s390x_features <feature> [<machine-model>]\n" );
       exit(3);                // Usage error.
    }
 
+   if (argv[1][0] == '!') {
+      assert(argv[2] == NULL);   // not allowed
+      inverted = 1;
+      ++argv[1];
+   }
+
    rc = go(argv[1], argv[2]);
+   
+   if (inverted) {
+      switch (rc) {
+      case 0: rc = 1; break;
+      case 1: rc = 0; break;
+      case 2: rc = 2; break;
+      }
+   }
 
    //   printf("rc = %d\n", rc);