1From 80ab9f712667317379a836d14c9efe070aca1edc Mon Sep 17 00:00:00 2001
2From: Steve Muckle <[email protected]>
3Date: Mon, 9 Oct 2017 14:35:11 -0700
4Subject: [PATCH 06/20] execveat: build exec kselftest for Android
5
6The Makefile for the exec kselftest creates a script, symlink, copy of
7the binary, etc. Rather than have VTS copy all these items to the
8target, create a wrapper script to create these on the target. Note that
9the test also tries to access its Makefile.
10
11(cherry picked from commit ea307c2e597a51f6cf60a786f2f2839413571e61)
12Bug: 67016227
13Test: run vts-kernel -m VtsKernelLinuxKselftestStaging
14Signed-off-by: Steve Muckle <[email protected]>
15---
16 tools/testing/selftests/exec/execveat.sh | 33 ++++++++++++++++++++++++
17 1 file changed, 33 insertions(+)
18 create mode 100755 tools/testing/selftests/exec/execveat.sh
19
20diff --git a/tools/testing/selftests/exec/execveat.sh b/tools/testing/selftests/exec/execveat.sh
21new file mode 100755
22index 000000000000..dc049eaef690
23--- /dev/null
24+++ b/tools/testing/selftests/exec/execveat.sh
25@@ -0,0 +1,33 @@
26+#!/system/bin/sh
27+
28+#
29+# Copyright (C) 2017 The Android Open Source Project
30+#
31+# Licensed under the Apache License, Version 2.0 (the "License");
32+# you may not use this file except in compliance with the License.
33+# You may obtain a copy of the License at
34+#
35+#      http://www.apache.org/licenses/LICENSE-2.0
36+#
37+# Unless required by applicable law or agreed to in writing, software
38+# distributed under the License is distributed on an "AS IS" BASIS,
39+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+# See the License for the specific language governing permissions and
41+# limitations under the License.
42+#
43+
44+# These are normally created as part of the kselftest build but for VTS
45+# it is probably easier to use a wrapper script that creates them
46+# at runtime, on target, as part of the test.
47+
48+DIR=$(dirname "$0")
49+cd $DIR && \
50+mkdir -p subdir && \
51+echo '#!/system/bin/sh' > script && \
52+echo 'exit $*' >> script && \
53+chmod +x script && \
54+touch Makefile && \
55+ln -s -f execveat execveat.symlink && \
56+cp execveat execveat.denatured && \
57+chmod -x execveat.denatured && \
58+./execveat
59--
602.42.0.609.gbb76f46606-goog
61
62