]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r9175 (don't run inappropriate OS- and platform-specific tests) from
authorNicholas Nethercote <njn@valgrind.org>
Mon, 16 Feb 2009 00:42:10 +0000 (00:42 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Mon, 16 Feb 2009 00:42:10 +0000 (00:42 +0000)
the DARWIN branch.

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

26 files changed:
configure.in
docs/internals/porting-HOWTO.txt
docs/internals/porting-to-ARM.txt
memcheck/tests/x86/fxsave.vgtest
memcheck/tests/x86/sse1_memory.vgtest
memcheck/tests/x86/sse2_memory.vgtest
memcheck/tests/x86/xor-undef-x86.vgtest
none/tests/amd64/insn_sse3.vgtest
none/tests/amd64/insn_ssse3.vgtest
none/tests/amd64/ssse3_misaligned.vgtest
none/tests/x86/bug137714-x86.vgtest
none/tests/x86/cse_fail.vgtest
none/tests/x86/insn_cmov.vgtest
none/tests/x86/insn_fpu.vgtest
none/tests/x86/insn_mmx.vgtest
none/tests/x86/insn_mmxext.vgtest
none/tests/x86/insn_sse.vgtest
none/tests/x86/insn_sse2.vgtest
none/tests/x86/insn_sse3.vgtest
none/tests/x86/insn_ssse3.vgtest
none/tests/x86/ssse3_misaligned.vgtest
tests/Makefile.am
tests/arch_test.c [moved from tests/cputest.c with 79% similarity]
tests/os_test.in [new file with mode: 0644]
tests/platform_test [new file with mode: 0644]
tests/vg_regtest.in

index 3e9e76c4dab7b0c842f2033212a6e4d3095ca15f..63fa8e4d08cff8e6fe3b7252ce22989a72c0b69a 100644 (file)
@@ -1690,6 +1690,7 @@ AC_OUTPUT(
    docs/xml/Makefile
    tests/Makefile 
    tests/vg_regtest 
+   tests/os_test 
    perf/Makefile 
    perf/vg_perf
    include/Makefile 
index 121e39c856f0688599159fe4c9ffc1790cd08f29..abc9a97e379da0fd8fd08894f44c31f70c8110d6 100644 (file)
@@ -68,8 +68,9 @@ Once it compiles ok, get it to run:
 
 Once it runs ok:
 
-- Add the cpu to the tests/cputest.c file so the reg test script will work.
-  (Don't forget to add it to all_archs[].)
+- Add the arch to the tests/arch_test.c file so the reg test script will work.
+  (Don't forget to add it to all_archs[].)  Likewise for os_test.in and
+  platform_test.
 
 - Ensure the regression tests work, and add some arch-specific tests to
   none/tests directory.
index d99f9adb4ebab00ded16b6b635731482dff89136..4e54d2476feb889ba998cf2e77cf3e8592502c46 100644 (file)
@@ -156,7 +156,7 @@ From coregrind/m_signals.c
 #  error VG_UCONTEXT_SYSCALL_RET undefined for ARM/Linux
 
 =============================================================================
-From tests/cputest.c
+From tests/arch_test.c
 =============================================================================
 - You'll need to add "arm" to all_archs[].
 
index 1049e6330782797eeff6e0619199ba5cb0357597..93a87a9ad2398f1f6aae2fc6cc923cb0a918188a 100644 (file)
@@ -1,4 +1,4 @@
 prog: fxsave
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
 vgopts: -q
 args: x
index 5134ea9170cb518816616b886777927a1b099739..cf6cd55f2c52f75932a2490ecdaafe0291672055 100644 (file)
@@ -1,4 +1,4 @@
 prog: sse_memory
 vgopts: -q
 args: sse1
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
index 8eaeca60bf2b21f2fc439b3ecf71ac0beaead690..1fe8856d773505757ec2e180c73d6f2ad065a72f 100644 (file)
@@ -1,4 +1,4 @@
 prog: sse_memory
 vgopts: -q
 args: sse2
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
index daa648bb365d6efc6f043b214f4b2ac50e2f2a3f..495a57c77b456b9cb9484eb7549239f3a3d06e85 100644 (file)
@@ -1,2 +1,2 @@
 prog: xor-undef-x86
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
index af3d9c6072d6aee02bfc4502e0d5f8cfe5cda62f..ccf6cffe93a20136250076ecec0a4ec50c9effa6 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/amd64/insn_sse3
-prereq: ../../../tests/cputest amd64-sse3
+prereq: ../../../tests/arch_test amd64-sse3
 vgopts: -q
index 311d8f24c10a977e3ea674f1321d986fb57a6fd7..d08dc3d654c1a5d0d62106241ee4df9cc7ebf5ac 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/amd64/insn_ssse3
-prereq: ../../../tests/cputest amd64-ssse3
+prereq: ../../../tests/arch_test amd64-ssse3
 vgopts: -q
index ba7656859a938f3e684bac7930753ec9192e33e0..76255d941277deadb096c1940fa2efbd4c5f8b8e 100644 (file)
@@ -1,3 +1,3 @@
 prog: ssse3_misaligned
-prereq: ../../../tests/cputest amd64-ssse3
+prereq: ../../../tests/arch_test amd64-ssse3
 vgopts: -q
index 35bd7dfb48ade5e6ac12bc7832717bee4877490a..ab1560e85f13b855daa657545458203e4cb68a8b 100644 (file)
@@ -1,3 +1,3 @@
 prog: bug137714-x86
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
 vgopts: -q
index 13e64bd0c568d1b75d48dd812fba524ce72290a8..6c0092cbc9d5784b7d8988e9fa7223e83bb40a7c 100644 (file)
@@ -1,3 +1,3 @@
 prog: cse_fail
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
 vgopts: -q
index e4cf7569714a5a7538ba763717beb9950deccff2..42b44b993643d8c84db81a21fa2e9a009aa2a36b 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_cmov
-prereq: ../../../tests/cputest x86-cmov
+prereq: ../../../tests/arch_test x86-cmov
 vgopts: -q
index cb7cb8b1c7bf18f38cd085a867d17d3c896a4357..01e514a37860e8c9ae2c79bbeba120cadd95806e 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_fpu
-prereq: ../../../tests/cputest x86-fpu
+prereq: ../../../tests/arch_test x86-fpu
 vgopts: -q
index 301f38a7b2a3dce49acfd4878ce22ffcb898d411..88adf5b10e463457f2c51ac8285fa1b718c6dcff 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_mmx
-prereq: ../../../tests/cputest x86-mmx
+prereq: ../../../tests/arch_test x86-mmx
 vgopts: -q
index 42dc0e1ef11b3e6d64a3c3ceff931bdff7d5d4c8..2b42ff422738c5a33ea80dd8c4041962ed5d378b 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_mmxext
-prereq: ../../../tests/cputest x86-mmxext
+prereq: ../../../tests/arch_test x86-mmxext
 vgopts: -q
index 731dae81dcd7b260086bf89f803790468a91c199..24a7f066e20368009a68109caba97c869f6bbc2e 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_sse
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
 vgopts: -q
index 7f4bbaf323134b61e7cbc79755976c4cb0afd39d..a13a51d619f960cb931a2f72fa199ac294e63c76 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_sse2
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
 vgopts: -q
index c471163be93804b6369c6f60729ee7f58f5962eb..6c679991be2cc27a3c7991c198d1ae41d47d9f57 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_sse3
-prereq: ../../../tests/cputest x86-sse3
+prereq: ../../../tests/arch_test x86-sse3
 vgopts: -q
index 10c976cee4e1c5420bc63598e7002040d7dbd16e..c9b5a61603704edab98317dfeaac81ddae77b79b 100644 (file)
@@ -1,3 +1,3 @@
 prog: ../../../none/tests/x86/insn_ssse3
-prereq: ../../../tests/cputest x86-ssse3
+prereq: ../../../tests/arch_test x86-ssse3
 vgopts: -q
index 15e8324281bb253f49cefa7da04c5cb6990a9cd3..bd570b65ee6eae7594741ff80f2a75702630f8ed 100644 (file)
@@ -1,3 +1,3 @@
 prog: ssse3_misaligned
-prereq: ../../../tests/cputest x86-ssse3
+prereq: ../../../tests/arch_test x86-ssse3
 vgopts: -q
index bb4670314f4e692433022a80644726b5cd5842eb..9109378b79baf4ab3ee71804ccaeb26afd8e33f7 100644 (file)
@@ -3,19 +3,21 @@
 include $(top_srcdir)/Makefile.flags.am
 
 noinst_SCRIPTS = \
-       vg_regtest \
        filter_addresses \
        filter_discards \
        filter_libc \
        filter_numbers \
        filter_stderr_basic \
        filter_sink \
-       filter_test_paths
+       filter_test_paths \
+       os_test \
+       platform_test \
+       vg_regtest
 
 EXTRA_DIST = $(noinst_SCRIPTS)
 
 check_PROGRAMS = \
-       cputest \
+       arch_test \
        toobig-allocs \
        true
 
@@ -23,7 +25,7 @@ AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # generic C ones
-cputest_CFLAGS         = $(AM_CFLAGS) \
+arch_test_CFLAGS       = $(AM_CFLAGS) \
                                -DVGA_$(VGCONF_ARCH_PRI)=1 \
                                -DVGO_$(VGCONF_OS)=1 \
                                -DVGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS)=1
similarity index 79%
rename from tests/cputest.c
rename to tests/arch_test.c
index fc82b73928fce9cc99cd831a45425e7c65b7a610..398cb67e6fe9893e1c2d4ff4402d31b00103158e 100644 (file)
@@ -92,9 +92,39 @@ static void cpuid ( unsigned int n,
 #endif   // VGP_x86_linux || VGP_amd64_linux
 
 //---------------------------------------------------------------------------
-// {x86,amd64}-{linux} (part 2 of 2)
+// {x86,amd64}-darwin (part 1 of 2)
 //---------------------------------------------------------------------------
-#if defined(VGP_x86_linux)  || defined(VGP_amd64_linux)
+#if defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
+static void cpuid ( unsigned int n,
+                    unsigned int* a, unsigned int* b,
+                    unsigned int* c, unsigned int* d )
+{
+   __asm__ __volatile__ (
+       "pushl %%eax\n\t"
+       "pushl %%ebx\n\t"
+       "pushl %%ecx\n\t"
+       "pushl %%edx\n\t"
+       "movl %4, %%eax\n\t"
+       "cpuid\n\t"
+       "movl %%eax,%0\n\t"
+       "movl %%ebx,%1\n\t"
+       "movl %%ecx,%2\n\t"
+       "movl %%edx,%3\n\t"
+       "popl %%edx\n\t"
+       "popl %%ecx\n\t"
+       "popl %%ebx\n\t"
+       "popl %%eax\n\t"
+       : "=m" (*a), "=m" (*b), "=m" (*c), "=m" (*d)
+       : "mr" (n)
+       );
+}
+#endif   // VGP_x86_darwin || VGP_amd64_darwin
+
+//---------------------------------------------------------------------------
+// {x86,amd64}-{linux,darwin} (part 2 of 2)
+//---------------------------------------------------------------------------
+#if defined(VGP_x86_linux)  || defined(VGP_amd64_linux) || \
+    defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
 static Bool go(char* cpu)
 { 
    unsigned int level = 0, cmask = 0, dmask = 0, a, b, c, d;
@@ -152,7 +182,8 @@ static Bool go(char* cpu)
    }
    return False;
 }
-#endif   // VGP_x86_linux  || VGP_amd64_linux
+#endif   // VGP_x86_linux  || VGP_amd64_linux ||
+         // VGP_x86_darwin || VGP_amd64_darwin
 
 
 //---------------------------------------------------------------------------
@@ -162,7 +193,7 @@ int main(int argc, char **argv)
 {
    int i;
    if ( argc != 2 ) {
-      fprintf( stderr, "usage: cputest <cpu-type>\n" );
+      fprintf( stderr, "usage: arch_test <cpu-type>\n" );
       exit( 2 );
    }
    if (go( argv[1] )) {
diff --git a/tests/os_test.in b/tests/os_test.in
new file mode 100644 (file)
index 0000000..27410dd
--- /dev/null
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+# This script determines which OSes that this Valgrind installation
+# supports, which depends on the machine's OS.
+# We return:
+# - 0 if the machine matches the asked-for OS
+# - 1 if it didn't match, but did match the name of another OS
+# - 2 otherwise
+
+# Nb: When updating this file for a new OS, add the name to 'all_OSes'.
+
+all_OSes="linux aix5 darwin"
+
+if [ $# -ne 1 ] ; then
+    echo "usage: os_test <os-type>"
+    exit 2;
+fi
+
+if [ $1 = @VGCONF_OS@ ] ; then
+    exit 0;         # Matches this OS.
+fi
+
+for os in $all_OSes ; do
+    if [ $1 = $os ] ; then
+        exit 1;     # Matches another Valgrind-supported OS.
+    fi
+done
+
+exit 2;             # Doesn't match any Valgrind-supported OS.
diff --git a/tests/platform_test b/tests/platform_test
new file mode 100644 (file)
index 0000000..e11d5d8
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# This script determines which platforms that this Valgrind installation
+# supports.
+# We return:
+# - 0 if the machine matches the asked-for platform
+# - 1 if it didn't match, but did match the name of another platform
+# - 2 otherwise
+
+# Nb: When updating this file for a new platform, add the name to
+# 'all_platforms'.
+
+all_platforms=
+all_platforms="$all_platforms x86-linux amd64-linux ppc32-linux ppc64-linux"
+all_platforms="$all_platforms ppc32-aix5 ppc64-aix5"
+all_platforms="$all_platforms x86-darwin amd64-darwin"
+
+if [ $# -ne 2 ] ; then
+    echo "usage: platform_test <arch-type> <OS-type>"
+    exit 2;
+fi
+
+# Get the directory holding the arch_test and os_test, which will be the same
+# as the one holding this script.
+dir=`dirname $0`
+
+if $dir/arch_test $1 && sh $dir/os_test $2 ; then
+    exit 0;         # Matches this platform.
+fi
+
+for p in $all_platforms ; do
+    if [ $1-$2 = $p ] ; then
+        exit 1;     # Matches another Valgrind-supported platform.
+    fi
+done
+
+exit 2;             # Doesn't match any Valgrind-supported platform.
index bc065da1cdc8dd89b3843dfc4d313d52f3e316a9..1d397a68965a4b27f3b177c2a51a25cc86db12b2 100755 (executable)
@@ -378,14 +378,18 @@ sub test_one_dir($$)
     # Ignore dirs into which we should not recurse.
     if ($dir =~ /^(BitKeeper|CVS|SCCS|docs|doc)$/) { return; }
 
-    (-x "$tests_dir/tests/cputest") or die 
-        "vg_regtest: 'cputest' is missing.  Did you forget to 'make check'?\n";
+    (-x "$tests_dir/tests/arch_test") or die 
+        "vg_regtest: 'arch_test' is missing.  Did you forget to 'make check'?\n";
     
     # Ignore any dir whose name matches that of an architecture which is not
-    # the architecture we are running on (eg. when running on x86, ignore ppc/
-    # directories).
+    # the architecture we are running on.  Eg. when running on x86, ignore
+    # ppc/ directories ('arch_test' returns 1 for this case).  Likewise for
+    # the OS and platform.
     # Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256...
-    if (256 == system("$tests_dir/tests/cputest $dir")) { return; }
+    if (256 == system(   "$tests_dir/tests/arch_test     $dir"))  { return; }
+    if (256 == system("sh $tests_dir/tests/os_test       $dir"))  { return; }
+    if ($dir =~ /(\w+)-(\w+)/ &&
+        256 == system("sh $tests_dir/tests/platform_test $1 $2")) { return; }
     
     chdir($dir) or die "Could not change into $dir\n";