ftmemsim-valgrind/tests/platform_test
Nicholas Nethercote 4c23a0b3e9 tests/arch_test is currently being used for two purposes:
- by vg_regtest for determining if a directory name matches an architecture;
- by various .vgtest files for detecting x86/AMD64 features.

This commit splits it in two for the two different purposes, which makes
things clearer.

Specific changes

- Moved the x86/AMD64 feature detection stuff out of arch_test.c, and
  into the new x86_amd64_feature.c.  Updated the relevant .vgtest files for
  the change.

- In vg_regtest, now a prereq command must return 0 (prereq satisfied) or 1
  (prereq not satisfied).  Anything else makes vg_regtest abort.  This
  makes obvious any problems with prereq tests rather than just making the
  tests skip innocuously.  (We previously had exactly such a problem on the
  DARWIN branch;  the x86 feature detection tests caused segfaults so the
  tests were incorrectly skipped.  This change will catch any similar future
  problem.)

- Changed os_test from a script to a C program, matching cpu_test.

- Removed some unintentional darwin stuff from platform_test.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9316
2009-03-04 04:15:16 +00:00

37 lines
1006 B
Bash

#! /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"
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 && $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.