2021-05-27 14:24:11 +02:00
#!/bin/bash -eu
2021-05-26 11:50:03 +02:00
2021-08-14 02:56:53 +02:00
ROOT = $( pwd )
RUNTIME = ${ ROOT } /youki
2021-08-18 11:02:29 +02:00
2021-05-26 11:50:03 +02:00
cd integration_test/src/github.com/opencontainers/runtime-tools
2021-08-18 11:02:29 +02:00
2021-08-14 02:56:53 +02:00
test_cases = (
2021-08-18 11:02:29 +02:00
"create/create.t"
2021-08-14 02:56:53 +02:00
"default/default.t"
2021-08-18 11:02:29 +02:00
"delete/delete.t"
"delete_only_create_resources/delete_only_create_resources.t"
"delete_resources/delete_resources.t"
"hooks/hooks.t"
"hooks_stdin/hooks_stdin.t"
"hostname/hostname.t"
"kill/kill.t"
"kill_no_effect/kill_no_effect.t"
"killsig/killsig.t"
# "linux_cgroups_blkio/linux_cgroups_blkio.t"
"linux_cgroups_cpus/linux_cgroups_cpus.t"
2021-08-14 02:56:53 +02:00
"linux_cgroups_devices/linux_cgroups_devices.t"
2021-08-18 11:02:29 +02:00
"linux_cgroups_hugetlb/linux_cgroups_hugetlb.t"
2021-08-14 02:56:53 +02:00
"linux_cgroups_memory/linux_cgroups_memory.t"
"linux_cgroups_network/linux_cgroups_network.t"
2021-08-18 11:02:29 +02:00
"linux_cgroups_pids/linux_cgroups_pids.t"
# "linux_cgroups_relative_blkio/linux_cgroups_relative_blkio.t"
2021-08-14 02:56:53 +02:00
"linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.t"
"linux_cgroups_relative_devices/linux_cgroups_relative_devices.t"
2021-08-18 11:02:29 +02:00
"linux_cgroups_relative_hugetlb/linux_cgroups_relative_hugetlb.t"
2021-08-14 02:56:53 +02:00
"linux_cgroups_relative_memory/linux_cgroups_relative_memory.t"
2021-08-18 11:02:29 +02:00
"linux_cgroups_relative_network/linux_cgroups_relative_network.t"
2021-08-14 02:56:53 +02:00
"linux_cgroups_relative_pids/linux_cgroups_relative_pids.t"
2021-08-18 11:02:29 +02:00
"linux_devices/linux_devices.t"
# "linux_masked_paths/linux_masked_paths.t"
"linux_mount_label/linux_mount_label.t"
# "linux_ns_itype/linux_ns_itype.t"
# "linux_ns_nopath/linux_ns_nopath.t"
# "linux_ns_path/linux_ns_path.t"
# "linux_ns_path_type/linux_ns_path_type.t"
# "linux_process_apparmor_profile/linux_process_apparmor_profile.t"
# "linux_readonly_paths/linux_readonly_paths.t"
# "linux_rootfs_propagation/linux_rootfs_propagation.t"
# "linux_seccomp/linux_seccomp.t"
2021-08-14 02:56:53 +02:00
"linux_sysctl/linux_sysctl.t"
2021-08-18 11:02:29 +02:00
# "linux_uid_mappings/linux_uid_mappings.t"
# "misc_props/misc_props.t"
# "mounts/mounts.t"
# "pidfile/pidfile.t"
2021-08-14 02:56:53 +02:00
"poststart/poststart.t"
"poststart_fail/poststart_fail.t"
"poststop/poststop.t"
2021-08-18 11:02:29 +02:00
"poststop_fail/poststop_fail.t"
"prestart/prestart.t"
"prestart_fail/prestart_fail.t"
# "process/process.t"
"process_capabilities/process_capabilities.t"
"process_capabilities_fail/process_capabilities_fail.t"
# "process_oom_score_adj/process_oom_score_adj.t"
"process_rlimits/process_rlimits.t"
"process_rlimits_fail/process_rlimits_fail.t"
# "process_user/process_user.t"
# "root_readonly_true/root_readonly_true.t"
# Record the tests that runc also fails to pass below, maybe we will fix this by origin integration test, issue: https://github.com/containers/youki/issues/56
# "start/start.t"
"state/state.t"
2021-08-14 02:56:53 +02:00
)
2021-08-19 14:28:46 +02:00
check_enviroment( ) {
test_case = $1
2021-08-20 14:27:08 +02:00
if [ [ $test_case = ~ .*( memory| hugetlb) .t ] ] ; then
2021-08-19 14:28:46 +02:00
if [ [ ! -e "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes" ] ] ; then
return 1
fi
fi
}
2021-08-18 11:02:29 +02:00
for case in " ${ test_cases [@] } " ; do
if [ [ ! -e " ${ ROOT } /integration_test/src/github.com/opencontainers/runtime-tools/validation/ $case " ] ] ; then
GOPATH = ${ ROOT } /integration_test make runtimetest validation-executables
break
fi
done
2021-08-14 02:58:52 +02:00
2021-05-26 11:50:03 +02:00
for case in " ${ test_cases [@] } " ; do
2021-08-19 14:28:46 +02:00
if ! check_enviroment $case ; then
echo " Skip $case bacause your enviroment doesn't support this test case "
continue
fi
2021-05-26 11:50:03 +02:00
echo " Running $case "
2021-08-14 02:56:53 +02:00
if [ 0 -ne $( sudo RUST_BACKTRACE = 1 YOUKI_LOG_LEVEL = debug RUNTIME = ${ RUNTIME } ${ ROOT } /integration_test/src/github.com/opencontainers/runtime-tools/validation/$case | grep "not ok" | wc -l) ] ; then
2021-05-26 11:50:03 +02:00
exit 1
fi
2021-05-30 11:30:40 +02:00
sleep 1
2021-05-26 11:50:03 +02:00
done