Fix tests which fail in kokoro

* open_create_test_runsc_ptrace_shared doesn't expect the write access to /
* exec_test_runsc_ptrace_shared could not find /usr/share/zoneinfo/
* clock_gettime_test_runsc_ptrace_shared didn't expect that
  a thread cpu time can be zero.
* affinity_test_runsc_ptrace_shared expected minimum 3 cpus

PiperOrigin-RevId: 237509429
Change-Id: I477937e5d2cdf3f8720836bfa972abd35d8220a3
This commit is contained in:
Andrei Vagin
2019-03-08 13:33:32 -08:00
committed by Shentubot
parent fbacb35039
commit 832589cb07
6 changed files with 17 additions and 16 deletions
+1 -7
View File
@@ -177,16 +177,10 @@ run_root_tests() {
# Run syscall unit tests.
run_syscall_tests() {
cd ${WORKSPACE_DIR}
# TODO: Exclude tests which fail.
bazel \
"${BAZEL_RBE_FLAGS[@]}" \
test "${BAZEL_BUILD_RBE_FLAGS[@]}" \
`bazel query //test/syscalls/... |
grep runsc_ptrace |
grep -v affinity_test_runsc_ptrace |
grep -v exec_test_runsc_ptrace |
grep -v open_create_test_runsc_ptrace |
grep -v clock_gettime_test_runsc_ptrace`
--test_tag_filters=runsc_ptrace //test/syscalls/...
}
# Find and rename all test xml and log files so that Sponge can pick them up.
-4
View File
@@ -34,10 +34,6 @@ platform(
name: "dockerPrivileged"
value: "true"
}
properties: {
name: "dockerRunAsRoot"
value: "true"
}
""",
)
+4 -1
View File
@@ -49,7 +49,10 @@ syscall_test(test = "//test/syscalls/linux:chroot_test")
syscall_test(test = "//test/syscalls/linux:clock_getres_test")
syscall_test(test = "//test/syscalls/linux:clock_gettime_test")
syscall_test(
size = "medium",
test = "//test/syscalls/linux:clock_gettime_test",
)
syscall_test(test = "//test/syscalls/linux:clock_nanosleep_test")
+1
View File
@@ -155,6 +155,7 @@ TEST_F(AffinityTest, Sanity) {
}
TEST_F(AffinityTest, NewThread) {
SKIP_IF(CPU_COUNT(&mask_) < 3);
ASSERT_NO_ERRNO(ClearLowestBit());
ASSERT_NO_ERRNO(ClearLowestBit());
EXPECT_THAT(sched_setaffinity(/*pid=*/0, sizeof(cpu_set_t), &mask_),
+6 -1
View File
@@ -87,7 +87,12 @@ TEST(ClockGettime, JavaThreadTime) {
ASSERT_EQ(0, pthread_getcpuclockid(pthread_self(), &clockid));
struct timespec tp;
ASSERT_THAT(clock_getres(clockid, &tp), SyscallSucceeds());
ASSERT_THAT(clock_gettime(clockid, &tp), SyscallSucceeds());
EXPECT_TRUE(tp.tv_sec > 0 || tp.tv_nsec > 0);
// A thread cputime is updated each 10msec and there is no approximation
// if a task is running.
do {
ASSERT_THAT(clock_gettime(clockid, &tp), SyscallSucceeds());
} while (tp.tv_sec == 0 && tp.tv_nsec == 0);
EXPECT_TRUE(tp.tv_sec > 0 || tp.tv_nsec > 0);
}
+5 -3
View File
@@ -476,8 +476,10 @@ TEST(ProcSelfExe, ChangesAcrossExecve) {
}
TEST(ExecTest, CloexecNormalFile) {
const FileDescriptor fd_closed_on_exec = ASSERT_NO_ERRNO_AND_VALUE(
Open("/usr/share/zoneinfo", O_RDONLY | O_CLOEXEC));
TempPath tempFile = ASSERT_NO_ERRNO_AND_VALUE(
TempPath::CreateFileWith(GetAbsoluteTestTmpdir(), "bar", 0755));
const FileDescriptor fd_closed_on_exec =
ASSERT_NO_ERRNO_AND_VALUE(Open(tempFile.path(), O_RDONLY | O_CLOEXEC));
CheckOutput(WorkloadPath(kAssertClosedWorkload),
{WorkloadPath(kAssertClosedWorkload),
@@ -487,7 +489,7 @@ TEST(ExecTest, CloexecNormalFile) {
// The assert closed workload exits with code 2 if the file still exists. We
// can use this to do a negative test.
const FileDescriptor fd_open_on_exec =
ASSERT_NO_ERRNO_AND_VALUE(Open("/usr/share/zoneinfo", O_RDONLY));
ASSERT_NO_ERRNO_AND_VALUE(Open(tempFile.path(), O_RDONLY));
CheckOutput(WorkloadPath(kAssertClosedWorkload),
{WorkloadPath(kAssertClosedWorkload),