aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:51:05 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:51:05 +0000
commitc1c3dbc9fa6ff045f85c4634007908b6ee4e18ca (patch)
tree202c2c2c79445480d24bdda25122921d34ee6768
parentba177a38fb0a332280290c4091de7e935fb6db55 (diff)
parentd287bd42390670208609531fc57c534553733498 (diff)
downloadlinux-kselftest-android12-mainline-cellbroadcast-release.tar.gz
Change-Id: I03871a07e6d59602f60abf99e8710e68e93c28bc
-rw-r--r--Android.bp112
-rw-r--r--METADATA3
-rw-r--r--OWNERS4
-rw-r--r--android/kselftest_test_list.mk2
-rw-r--r--tools/testing/selftests/rtc/rtctest.c8
-rw-r--r--tools/testing/selftests/size/get_size.c24
6 files changed, 133 insertions, 20 deletions
diff --git a/Android.bp b/Android.bp
index 66b1f47a7bff..e56904c3722e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,6 +14,51 @@
// limitations under the License.
//
+package {
+ default_applicable_licenses: ["external_linux-kselftest_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// See: http://go/android-license-faq
+license {
+ name: "external_linux-kselftest_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ "SPDX-license-identifier-BSD-2-Clause",
+ "SPDX-license-identifier-BSD-3-Clause",
+ "SPDX-license-identifier-CC0-1.0",
+ "SPDX-license-identifier-GPL",
+ "SPDX-license-identifier-GPL-2.0",
+ "SPDX-license-identifier-GPL-3.0",
+ "SPDX-license-identifier-LGPL",
+ "SPDX-license-identifier-LGPL-2.1",
+ "SPDX-license-identifier-MIT",
+ "SPDX-license-identifier-Unlicense",
+ ],
+ license_text: [
+ "COPYING",
+ "NOTICE",
+ ],
+}
+
cc_defaults {
name: "kselftest_defaults",
cflags: [
@@ -49,14 +94,6 @@ cc_defaults {
no_named_install_directory: true,
test_per_src: true,
- arch: {
- mips: {
- enabled: false,
- },
- mips64: {
- enabled: false,
- },
- },
}
// breakpoints test
@@ -437,6 +474,11 @@ cc_test {
name: "kselftest_size_test",
relative_install_path: "linux-kselftest/size",
srcs: ["tools/testing/selftests/size/get_size.c"],
+ arch: {
+ x86_64: {
+ cflags: ["-mstackrealign"],
+ },
+ },
defaults: ["kselftest_defaults"],
nocrt: true,
// coverage runtime calls atexit, which is unavailable with nocrt.
@@ -573,6 +615,7 @@ cc_test {
"tools/testing/selftests/x86/syscall_nt.c",
"tools/testing/selftests/x86/test_mremap_vdso.c",
"tools/testing/selftests/x86/ldt_gdt.c",
+ "tools/testing/selftests/x86/syscall_arg_fault.c",
],
arch: {
arm: {
@@ -581,11 +624,15 @@ cc_test {
arm64: {
enabled: false,
},
+ x86_64: {
+ enabled: true,
+ static_libs: [
+ "libdl",
+ ],
+ },
x86: {
srcs: [
- "tools/testing/selftests/x86/sysret_ss_attrs.c",
//"tools/testing/selftests/x86/entry_from_vm86.c",
- "tools/testing/selftests/x86/syscall_arg_fault.c",
"tools/testing/selftests/x86/unwind_vdso.c",
"tools/testing/selftests/x86/test_FCMOV.c",
"tools/testing/selftests/x86/test_FCOMI.c",
@@ -620,6 +667,12 @@ cc_test {
arm64: {
enabled: false,
},
+ x86: {
+ enabled: true,
+ },
+ x86_64: {
+ enabled: true,
+ },
},
cflags: [
"-O2",
@@ -640,7 +693,6 @@ cc_test {
relative_install_path: "linux-kselftest/x86",
srcs: [
"tools/testing/selftests/x86/ptrace_syscall.c",
- "tools/testing/selftests/x86/raw_syscall_helper_32.S",
],
cflags: [
"-O2",
@@ -653,6 +705,44 @@ cc_test {
arch: {
x86: {
enabled: true,
+ srcs: [
+ "tools/testing/selftests/x86/raw_syscall_helper_32.S",
+ ],
+ },
+ x86_64: {
+ enabled: true,
+ },
+ },
+}
+
+cc_test {
+ name: "kselftest_x86_test_sysret_ss_attrs",
+ stem: "sysret_ss_attrs",
+ relative_install_path: "linux-kselftest/x86",
+ srcs: [
+ "tools/testing/selftests/x86/sysret_ss_attrs.c",
+ ],
+ cflags: [
+ "-O2",
+ "-pthread",
+ ],
+ c_std: "gnu99",
+ static_executable: true,
+ test_per_src: false,
+ defaults: ["kselftest_defaults"],
+ enabled: false,
+ arch: {
+ x86: {
+ enabled: true,
+ srcs: [
+ "tools/testing/selftests/x86/thunks_32.S",
+ ],
+ },
+ x86_64: {
+ enabled: true,
+ srcs: [
+ "tools/testing/selftests/x86/thunks.S",
+ ],
},
},
}
diff --git a/METADATA b/METADATA
new file mode 100644
index 000000000000..6d8601bb6816
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: RESTRICTED
+}
diff --git a/OWNERS b/OWNERS
index 66d3dd9849e6..64bf926733d4 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,2 +1,2 @@
-smuckle@google.com
-trong@google.com
+drosen@google.com
+willmcvicker@google.com
diff --git a/android/kselftest_test_list.mk b/android/kselftest_test_list.mk
index 57eee125623d..5445bd12d26f 100644
--- a/android/kselftest_test_list.mk
+++ b/android/kselftest_test_list.mk
@@ -59,11 +59,11 @@ kselftest_modules += \
kselftest_x86_tests_single_step_syscall \
kselftest_x86_tests_syscall_arg_fault \
kselftest_x86_tests_syscall_nt \
- kselftest_x86_tests_sysret_ss_attrs \
kselftest_x86_tests_test_FCMOV \
kselftest_x86_tests_test_FCOMI \
kselftest_x86_tests_test_FISTTP \
kselftest_x86_tests_test_mremap_vdso \
kselftest_x86_tests_unwind_vdso \
kselftest_x86_tests_vdso_restorer \
+ kselftest_x86_test_sysret_ss_attrs \
kselftest_x86_test_syscall_vdso \
diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c
index 92c403558dc5..845f07733216 100644
--- a/tools/testing/selftests/rtc/rtctest.c
+++ b/tools/testing/selftests/rtc/rtctest.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
@@ -324,6 +325,8 @@ __constructor_order_last(void)
int main(int argc, char **argv)
{
+ struct stat st;
+
switch (argc) {
case 2:
rtc_file = argv[1];
@@ -335,5 +338,10 @@ int main(int argc, char **argv)
return 1;
}
+ if (stat(rtc_file, &st) < 0 || !S_ISCHR(st.st_mode)) {
+ printf("no RTC present\n");
+ return 0;
+ }
+
return test_harness_run(argc, argv);
}
diff --git a/tools/testing/selftests/size/get_size.c b/tools/testing/selftests/size/get_size.c
index 2ad45b944355..2980b1a63366 100644
--- a/tools/testing/selftests/size/get_size.c
+++ b/tools/testing/selftests/size/get_size.c
@@ -11,23 +11,35 @@
* own execution. It also attempts to have as few dependencies
* on kernel features as possible.
*
- * It should be statically linked, with startup libs avoided.
- * It uses no library calls, and only the following 3 syscalls:
+ * It should be statically linked, with startup libs avoided. It uses
+ * no library calls except the syscall() function for the following 3
+ * syscalls:
* sysinfo(), write(), and _exit()
*
* For output, it avoids printf (which in some C libraries
* has large external dependencies) by implementing it's own
* number output and print routines, and using __builtin_strlen()
+ *
+ * The test may crash if any of the above syscalls fails because in some
+ * libc implementations (e.g. the GNU C Library) errno is saved in
+ * thread-local storage, which does not get initialized due to avoiding
+ * startup libs.
*/
#include <sys/sysinfo.h>
#include <unistd.h>
+#include <sys/syscall.h>
#define STDOUT_FILENO 1
static int print(const char *s)
{
- return write(STDOUT_FILENO, s, __builtin_strlen(s));
+ size_t len = 0;
+
+ while (s[len] != '\0')
+ len++;
+
+ return syscall(SYS_write, STDOUT_FILENO, s, len);
}
static inline char *num_to_str(unsigned long num, char *buf, int len)
@@ -79,12 +91,12 @@ void _start(void)
print("TAP version 13\n");
print("# Testing system size.\n");
- ccode = sysinfo(&info);
+ ccode = syscall(SYS_sysinfo, &info);
if (ccode < 0) {
print("not ok 1");
print(test_name);
print(" ---\n reason: \"could not get sysinfo\"\n ...\n");
- _exit(ccode);
+ syscall(SYS_exit, ccode);
}
print("ok 1");
print(test_name);
@@ -100,5 +112,5 @@ void _start(void)
print(" ...\n");
print("1..1\n");
- _exit(0);
+ syscall(SYS_exit, 0);
}