| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
# This script determines which platforms that this Valgrind installation |
| 4 |
# supports. |
| 5 |
# We return: |
| 6 |
# - 0 if the machine matches the asked-for platform |
| 7 |
# - 1 if it didn't match, but did match the name of another platform |
| 8 |
# - 2 otherwise |
| 9 |
|
| 10 |
# Nb: When updating this file for a new platform, add the name to |
| 11 |
# 'all_platforms'. |
| 12 |
|
| 13 |
all_platforms= |
| 14 |
all_platforms="$all_platforms x86-linux amd64-linux ppc32-linux ppc64-linux" |
| 15 |
all_platforms="$all_platforms arm-linux arm64-linux" |
| 16 |
all_platforms="$all_platforms s390x-linux mips32-linux mips64-linux" |
| 17 |
all_platforms="$all_platforms riscv64-linux" |
| 18 |
all_platforms="$all_platforms x86-darwin amd64-darwin" |
| 19 |
all_platforms="$all_platforms x86-solaris amd64-solaris" |
| 20 |
all_platforms="$all_platforms x86-freebsd amd64-freebsd" |
| 21 |
|
| 22 |
if [ $# -ne 2 ] ; then |
| 23 |
echo "usage: platform_test <arch-type> <OS-type>" |
| 24 |
exit 2; |
| 25 |
fi |
| 26 |
|
| 27 |
# Get the directory holding the arch_test and os_test, which will be the same |
| 28 |
# as the one holding this script. |
| 29 |
dir=`dirname $0` |
| 30 |
|
| 31 |
if $dir/arch_test $1 && $dir/os_test $2 ; then |
| 32 |
exit 0; # Matches this platform. |
| 33 |
fi |
| 34 |
|
| 35 |
for p in $all_platforms ; do |
| 36 |
if [ $1-$2 = $p ] ; then |
| 37 |
exit 1; # Matches another Valgrind-supported platform. |
| 38 |
fi |
| 39 |
done |
| 40 |
|
| 41 |
exit 2; # Doesn't match any Valgrind-supported platform. |