summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/x86/check_cc.sh
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2015-05-12 00:11:36 +0200
committerShuah Khan <shuahkh@osg.samsung.com>2015-05-13 04:02:40 +0200
commite9886ace222eb48bb57bd541320056ca334bd3a0 (patch)
tree11c057e7a46cff720383c099edbee96eec4b60e6 /tools/testing/selftests/x86/check_cc.sh
parentselftests, x86: Remove useless run_tests rule (diff)
downloadlinux-e9886ace222eb48bb57bd541320056ca334bd3a0.tar.xz
linux-e9886ace222eb48bb57bd541320056ca334bd3a0.zip
selftests, x86: Rework x86 target architecture detection
We currently fail to build on a non-multilib x86_64 target. We print a helpful error, but it's nicer to allow the build to succeed. Fix it and improve cross-compilation support by detecting architecture support directly and building only the relevant tests. Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/x86/check_cc.sh')
-rwxr-xr-xtools/testing/selftests/x86/check_cc.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/x86/check_cc.sh b/tools/testing/selftests/x86/check_cc.sh
new file mode 100755
index 000000000000..172d3293fb7b
--- /dev/null
+++ b/tools/testing/selftests/x86/check_cc.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# check_cc.sh - Helper to test userspace compilation support
+# Copyright (c) 2015 Andrew Lutomirski
+# GPL v2
+
+CC="$1"
+TESTPROG="$2"
+shift 2
+
+if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then
+ echo 1
+else
+ echo 0
+fi
+
+exit 0