the DARWIN branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9176
docs/xml/Makefile
tests/Makefile
tests/vg_regtest
+ tests/os_test
perf/Makefile
perf/vg_perf
include/Makefile
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.
# 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[].
prog: fxsave
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
vgopts: -q
args: x
prog: sse_memory
vgopts: -q
args: sse1
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
prog: sse_memory
vgopts: -q
args: sse2
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
prog: xor-undef-x86
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
prog: ../../../none/tests/amd64/insn_sse3
-prereq: ../../../tests/cputest amd64-sse3
+prereq: ../../../tests/arch_test amd64-sse3
vgopts: -q
prog: ../../../none/tests/amd64/insn_ssse3
-prereq: ../../../tests/cputest amd64-ssse3
+prereq: ../../../tests/arch_test amd64-ssse3
vgopts: -q
prog: ssse3_misaligned
-prereq: ../../../tests/cputest amd64-ssse3
+prereq: ../../../tests/arch_test amd64-ssse3
vgopts: -q
prog: bug137714-x86
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
vgopts: -q
prog: cse_fail
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
vgopts: -q
prog: ../../../none/tests/x86/insn_cmov
-prereq: ../../../tests/cputest x86-cmov
+prereq: ../../../tests/arch_test x86-cmov
vgopts: -q
prog: ../../../none/tests/x86/insn_fpu
-prereq: ../../../tests/cputest x86-fpu
+prereq: ../../../tests/arch_test x86-fpu
vgopts: -q
prog: ../../../none/tests/x86/insn_mmx
-prereq: ../../../tests/cputest x86-mmx
+prereq: ../../../tests/arch_test x86-mmx
vgopts: -q
prog: ../../../none/tests/x86/insn_mmxext
-prereq: ../../../tests/cputest x86-mmxext
+prereq: ../../../tests/arch_test x86-mmxext
vgopts: -q
prog: ../../../none/tests/x86/insn_sse
-prereq: ../../../tests/cputest x86-sse
+prereq: ../../../tests/arch_test x86-sse
vgopts: -q
prog: ../../../none/tests/x86/insn_sse2
-prereq: ../../../tests/cputest x86-sse2
+prereq: ../../../tests/arch_test x86-sse2
vgopts: -q
prog: ../../../none/tests/x86/insn_sse3
-prereq: ../../../tests/cputest x86-sse3
+prereq: ../../../tests/arch_test x86-sse3
vgopts: -q
prog: ../../../none/tests/x86/insn_ssse3
-prereq: ../../../tests/cputest x86-ssse3
+prereq: ../../../tests/arch_test x86-ssse3
vgopts: -q
prog: ssse3_misaligned
-prereq: ../../../tests/cputest x86-ssse3
+prereq: ../../../tests/arch_test x86-ssse3
vgopts: -q
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
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
#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;
}
return False;
}
-#endif // VGP_x86_linux || VGP_amd64_linux
+#endif // VGP_x86_linux || VGP_amd64_linux ||
+ // VGP_x86_darwin || VGP_amd64_darwin
//---------------------------------------------------------------------------
{
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] )) {
--- /dev/null
+#! /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.
--- /dev/null
+#! /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.
# 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";