• Home
  • Raw
  • Download

Lines Matching +full:musl +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
4 * Copyright (c) Linux Test Project, 2016-2021
37 #include "ltp-version.h"
48 #define MUSL_GIT_URL "https://git.musl-libc.org/cgit/musl/commit/src/linux/clone.c?id="
49 #define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
57 static float duration = -1;
58 static float timeout_mul = -1;
98 if (access("/dev/shm", F_OK) == 0) { in setup_ipc()
99 snprintf(shm_path, sizeof(shm_path), "/dev/shm/ltp_%s_%d", in setup_ipc()
123 if (tst_test->needs_checkpoints || tst_test->child_needs_reinit) { in setup_ipc()
132 if (tst_test->needs_checkpoints) { in setup_ipc()
134 tst_max_futexes = (size - sizeof(struct results))/sizeof(futex_t); in setup_ipc()
171 tst_max_futexes = (size - sizeof(struct results))/sizeof(futex_t); in tst_reinit()
183 tst_atomic_inc(&results->skipped); in update_results()
186 tst_atomic_inc(&results->passed); in update_results()
189 tst_atomic_inc(&results->warnings); in update_results()
192 tst_atomic_inc(&results->failed); in update_results()
195 tst_atomic_inc(&results->broken); in update_results()
247 int_errno = TST_RET < 0 ? -(int)TST_RET : (int)TST_RET; in print_result()
253 size -= ret; in print_result()
261 size -= ret; in print_result()
263 ssize = size - 2; in print_result()
266 size -= MIN(ret, ssize); in print_result()
271 ssize = size - 2; in print_result()
274 size -= MIN(ret, ssize); in print_result()
283 buflen = str - buf + 1; in print_result()
291 buflen -= ret; in print_result()
325 if (tst_test->cleanup) in do_test_cleanup()
326 tst_test->cleanup(); in do_test_cleanup()
437 if (!tst_test->forks_child) in safe_fork()
460 if (!tst_test->forks_child) in safe_clone()
466 case -1: in safe_clone()
469 case -2: in safe_clone()
471 return -1; in safe_clone()
504 static float runtime_mul = -1; in multiply_runtime()
518 {"h", "-h Prints this help"},
519 {"i:", "-i n Execute test n times"},
520 {"I:", "-I x Execute test for n seconds"},
521 {"D", "-D Prints debug information"},
522 {"V", "-V Prints LTP version"},
523 {"C:", "-C ARG Run child process with ARG arguments (used internally)"},
531 /* see doc/User-Guidelines.asciidoc, which lists also shell API variables */ in print_help()
533 fprintf(stderr, "---------------------\n"); in print_help()
540 …fprintf(stderr, "LTP_SINGLE_FS_TYPE Testing only - specifies filesystem instead all supported (f… in print_help()
548 fprintf(stderr, "-------------------\n"); in print_help()
550 if (tst_test->max_runtime) { in print_help()
551 runtime = multiply_runtime(tst_test->max_runtime); in print_help()
569 fprintf(stderr, "-------\n"); in print_help()
574 if (!tst_test->options) in print_help()
577 for (i = 0; tst_test->options[i].optstr; i++) { in print_help()
578 fprintf(stderr, "-%c\t %s\n", in print_help()
579 tst_test->options[i].optstr[0], in print_help()
580 tst_test->options[i].help); in print_help()
587 const struct tst_tag *tags = tst_test->tags; in print_test_tags()
593 fprintf(stderr, "----\n"); in print_test_tags()
598 else if (!strcmp(tags[i].name, "linux-git")) in print_test_tags()
600 else if (!strcmp(tags[i].name, "linux-stable-git")) in print_test_tags()
602 else if (!strcmp(tags[i].name, "glibc-git")) in print_test_tags()
604 else if (!strcmp(tags[i].name, "musl-git")) in print_test_tags()
616 struct tst_option *toptions = tst_test->options; in check_option_collision()
635 if (!tst_test->options) in count_options()
638 for (i = 0; tst_test->options[i].optstr; i++) in count_options()
647 struct tst_option *toptions = tst_test->options; in parse_topt()
658 tst_res(TWARN, "Option -%c passed multiple times", opt); in parse_topt()
682 strcat(optstr, tst_test->options[i].optstr); in parse_opts()
702 if (tst_test->max_runtime > 0) in parse_opts()
703 tst_test->max_runtime = SAFE_STRTOL(optarg, 1, INT_MAX); in parse_opts()
841 const struct tst_tag *tags = tst_test->tags; in print_failure_hint()
869 print_failure_hint("linux-git", "missing kernel fixes", LINUX_GIT_URL); in print_failure_hints()
870 print_failure_hint("linux-stable-git", "missing stable kernel fixes", in print_failure_hints()
872 print_failure_hint("glibc-git", "missing glibc fixes", GLIBC_GIT_URL); in print_failure_hints()
873 print_failure_hint("musl-git", "missing musl fixes", MUSL_GIT_URL); in print_failure_hints()
875 print_failure_hint("known-fail", "hit by known kernel failures", NULL); in print_failure_hints()
881 if (results->passed && ret == TCONF) in do_exit()
884 if (results->failed) { in do_exit()
889 if (results->skipped && !results->passed) in do_exit()
892 if (results->warnings) in do_exit()
895 if (results->broken) { in do_exit()
901 fprintf(stderr, "passed %d\n", results->passed); in do_exit()
902 fprintf(stderr, "failed %d\n", results->failed); in do_exit()
903 fprintf(stderr, "broken %d\n", results->broken); in do_exit()
904 fprintf(stderr, "skipped %d\n", results->skipped); in do_exit()
905 fprintf(stderr, "warnings %d\n", results->warnings); in do_exit()
917 if (tst_parse_kver(tst_test->min_kver, &v1, &v2, &v3)) { in check_kver()
920 tst_test->min_kver); in check_kver()
925 tst_test->min_kver); in check_kver()
931 if (a->passed != b->passed) in results_equal()
934 if (a->failed != b->failed) in results_equal()
937 if (a->skipped != b->skipped) in results_equal()
940 if (a->broken != b->broken) in results_equal()
948 return tst_test->needs_tmpdir || in needs_tmpdir()
949 tst_test->needs_device || in needs_tmpdir()
950 tst_test->mntpoint || in needs_tmpdir()
951 tst_test->resource_files || in needs_tmpdir()
952 tst_test->needs_checkpoints; in needs_tmpdir()
959 for (i = 0; tst_test->resource_files[i]; i++) in copy_resources()
960 TST_RESOURCE_COPY(NULL, tst_test->resource_files[i], NULL); in copy_resources()
986 if (tst_test->test) in assert_test_fn()
989 if (tst_test->test_all) in assert_test_fn()
992 if (tst_test->sample) in assert_test_fn()
1001 if (tst_test->test && !tst_test->tcnt) in assert_test_fn()
1004 if (!tst_test->test && tst_test->tcnt) in assert_test_fn()
1008 static int prepare_and_mount_ro_fs(const char *dev, const char *mntpoint, in prepare_and_mount_ro_fs() argument
1013 if (mount(dev, mntpoint, fs_type, 0, NULL)) { in prepare_and_mount_ro_fs()
1015 dev, mntpoint, fs_type); in prepare_and_mount_ro_fs()
1028 SAFE_MOUNT(dev, mntpoint, fs_type, MS_REMOUNT | MS_RDONLY, NULL); in prepare_and_mount_ro_fs()
1049 SAFE_MOUNT("none", tst_test->mntpoint, "hugetlbfs", 0, NULL); in prepare_and_mount_hugetlb_fs()
1063 len = strlen(template) - 1; in tst_creat_unlinked()
1068 template[len--] = (char)c; in tst_creat_unlinked()
1085 if (!tst_test->dev_min_size) in limit_tmpfs_mount_size()
1106 return "ltp-tmpfs"; in get_device_name()
1108 return tdev.dev; in get_device_name()
1116 if (tst_test->format_device) { in prepare_device()
1117 SAFE_MKFS(tdev.dev, tdev.fs_type, tst_test->dev_fs_opts, in prepare_device()
1118 tst_test->dev_extra_opts); in prepare_device()
1121 if (tst_test->needs_rofs) { in prepare_device()
1122 prepare_and_mount_ro_fs(tdev.dev, tst_test->mntpoint, in prepare_device()
1127 if (tst_test->mount_device) { in prepare_device()
1128 mnt_data = limit_tmpfs_mount_size(tst_test->mnt_data, in prepare_device()
1131 SAFE_MOUNT(get_device_name(tdev.fs_type), tst_test->mntpoint, in prepare_device()
1132 tdev.fs_type, tst_test->mnt_flags, mnt_data); in prepare_device()
1140 .needs_ver = tst_test->needs_cgroup_ver, in do_cgroup_requires()
1142 const char *const *ctrl_names = tst_test->needs_cgroup_ctrls; in do_cgroup_requires()
1157 if (tst_test->max_runtime < -1) { in do_setup()
1159 results->max_runtime); in do_setup()
1162 if (tst_test->tconf_msg) in do_setup()
1163 tst_brk(TCONF, "%s", tst_test->tconf_msg); in do_setup()
1169 if (tst_test->sample) in do_setup()
1179 if (tst_test->needs_kconfigs && tst_kconfig_check(tst_test->needs_kconfigs)) in do_setup()
1182 if (tst_test->needs_root && geteuid() != 0) in do_setup()
1185 if (tst_test->min_kver) in do_setup()
1188 if (tst_test->supported_archs && !tst_is_on_arch(tst_test->supported_archs)) in do_setup()
1191 if (tst_test->skip_in_lockdown && tst_lockdown_enabled() > 0) in do_setup()
1194 if (tst_test->skip_in_secureboot && tst_secureboot_enabled() > 0) in do_setup()
1197 if (tst_test->skip_in_compat && TST_ABI != tst_kernel_bits()) in do_setup()
1198 tst_brk(TCONF, "Not supported in 32-bit compat mode"); in do_setup()
1200 if (tst_test->needs_cmds) { in do_setup()
1204 for (i = 0; (cmd = tst_test->needs_cmds[i]); ++i) in do_setup()
1208 if (tst_test->needs_drivers) { in do_setup()
1212 for (i = 0; (name = tst_test->needs_drivers[i]); ++i) in do_setup()
1217 if (tst_test->mount_device) in do_setup()
1218 tst_test->format_device = 1; in do_setup()
1220 if (tst_test->format_device) in do_setup()
1221 tst_test->needs_device = 1; in do_setup()
1223 if (tst_test->all_filesystems) in do_setup()
1224 tst_test->needs_device = 1; in do_setup()
1226 if (tst_test->min_cpus > (unsigned long)tst_ncpus()) in do_setup()
1227 tst_brk(TCONF, "Test needs at least %lu CPUs online", tst_test->min_cpus); in do_setup()
1229 if (tst_test->min_mem_avail > (unsigned long)(tst_available_mem() / 1024)) in do_setup()
1230 tst_brk(TCONF, "Test needs at least %luMB MemAvailable", tst_test->min_mem_avail); in do_setup()
1232 if (tst_test->min_swap_avail > (unsigned long)(tst_available_swap() / 1024)) in do_setup()
1233 tst_brk(TCONF, "Test needs at least %luMB SwapFree", tst_test->min_swap_avail); in do_setup()
1235 if (tst_test->hugepages.number) in do_setup()
1236 tst_reserve_hugepages(&tst_test->hugepages); in do_setup()
1240 if (tst_test->bufs) in do_setup()
1241 tst_buffers_alloc(tst_test->bufs); in do_setup()
1246 if (tst_test->save_restore) { in do_setup()
1247 const struct tst_path_val *pvl = tst_test->save_restore; in do_setup()
1249 while (pvl->path) { in do_setup()
1255 if (tst_test->mntpoint) in do_setup()
1256 SAFE_MKDIR(tst_test->mntpoint, 0777); in do_setup()
1258 if ((tst_test->needs_devfs || tst_test->needs_rofs || in do_setup()
1259 tst_test->mount_device || tst_test->all_filesystems || in do_setup()
1260 tst_test->needs_hugetlbfs) && in do_setup()
1261 !tst_test->mntpoint) { in do_setup()
1262 tst_brk(TBROK, "tst_test->mntpoint must be set!"); in do_setup()
1265 if (!!tst_test->needs_rofs + !!tst_test->needs_devfs + in do_setup()
1266 !!tst_test->needs_device + !!tst_test->needs_hugetlbfs > 1) { in do_setup()
1271 if (tst_test->needs_devfs) in do_setup()
1272 prepare_and_mount_dev_fs(tst_test->mntpoint); in do_setup()
1274 if (tst_test->needs_rofs) { in do_setup()
1275 /* If we failed to mount read-only tmpfs. Fallback to in do_setup()
1276 * using a device with read-only filesystem. in do_setup()
1278 if (prepare_and_mount_ro_fs(NULL, tst_test->mntpoint, "tmpfs")) { in do_setup()
1279 tst_res(TINFO, "Can't mount tmpfs read-only, " in do_setup()
1281 tst_test->needs_device = 1; in do_setup()
1282 tst_test->format_device = 1; in do_setup()
1286 if (tst_test->needs_hugetlbfs) in do_setup()
1289 if (tst_test->needs_device && !mntpoint_mounted) { in do_setup()
1290 tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size); in do_setup()
1292 if (!tdev.dev) in do_setup()
1295 tdev.size = tst_get_device_size(tdev.dev); in do_setup()
1299 if (tst_test->dev_fs_type) in do_setup()
1300 tdev.fs_type = tst_test->dev_fs_type; in do_setup()
1304 if (!tst_test->all_filesystems) in do_setup()
1308 if (tst_test->needs_overlay && !tst_test->mount_device) in do_setup()
1309 tst_brk(TBROK, "tst_test->mount_device must be set"); in do_setup()
1311 if (tst_test->needs_overlay && !mntpoint_mounted) in do_setup()
1312 tst_brk(TBROK, "tst_test->mntpoint must be mounted"); in do_setup()
1314 if (tst_test->needs_overlay && !ovl_mounted) { in do_setup()
1319 if (tst_test->resource_files) in do_setup()
1322 if (tst_test->restore_wallclock) in do_setup()
1325 if (tst_test->taint_check) in do_setup()
1326 tst_taint_init(tst_test->taint_check); in do_setup()
1328 if (tst_test->needs_cgroup_ctrls) in do_setup()
1330 else if (tst_test->needs_cgroup_ver) in do_setup()
1331 tst_brk(TBROK, "tst_test->needs_cgroup_ctrls must be set"); in do_setup()
1338 if (!tst_test->all_filesystems && tst_test->skip_filesystems) { in do_test_setup()
1342 if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems)) { in do_test_setup()
1350 if (tst_test->caps) in do_test_setup()
1351 tst_cap_setup(tst_test->caps, TST_CAP_REQ); in do_test_setup()
1353 if (tst_test->setup) in do_test_setup()
1354 tst_test->setup(); in do_test_setup()
1359 if (tst_test->caps) in do_test_setup()
1360 tst_cap_setup(tst_test->caps, TST_CAP_DROP); in do_test_setup()
1365 if (tst_test->needs_cgroup_ctrls) in do_cleanup()
1372 tst_umount(tst_test->mntpoint); in do_cleanup()
1374 if (tst_test->needs_device && tdev.dev) in do_cleanup()
1375 tst_release_device(tdev.dev); in do_cleanup()
1385 if (tst_test->restore_wallclock) in do_cleanup()
1414 if (!tst_test->test) { in run_tests()
1417 tst_test->test_all(); in run_tests()
1429 for (i = 0; i < tst_test->tcnt; i++) { in run_tests()
1432 tst_test->test(i); in run_tests()
1512 if (write(2, msg, sizeof(msg) - 1)) { \
1520 kill(-test_pid, SIGKILL); in alarm_handler()
1533 alarm(results->timeout); in heartbeat_handler()
1541 kill(-test_pid, SIGKILL); in sigint_handler()
1550 if (results->max_runtime == TST_UNLIMITED_RUNTIME) in tst_remaining_runtime()
1553 if (results->max_runtime == 0) in tst_remaining_runtime()
1560 if (results->max_runtime > elapsed) in tst_remaining_runtime()
1561 return results->max_runtime - elapsed; in tst_remaining_runtime()
1581 if (results->max_runtime == TST_UNLIMITED_RUNTIME) { in set_timeout()
1586 if (results->max_runtime < 0) { in set_timeout()
1587 tst_brk(TBROK, "max_runtime must to be >= -1! (%d)", in set_timeout()
1588 results->max_runtime); in set_timeout()
1591 results->timeout = tst_multiply_timeout(timeout) + results->max_runtime; in set_timeout()
1594 results->timeout/3600, (results->timeout%3600)/60, in set_timeout()
1595 results->timeout % 60); in set_timeout()
1600 results->max_runtime = multiply_runtime(max_runtime); in tst_set_max_runtime()
1614 alarm(results->timeout); in fork_testrun()
1635 if (tst_test->taint_check && tst_taint_check()) { in fork_testrun()
1640 if (tst_test->forks_child && kill(-test_pid, SIGKILL) == 0) in fork_testrun()
1662 const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems); in run_tcases_per_fs()
1677 tst_umount(tst_test->mntpoint); in run_tcases_per_fs()
1711 if (tst_test->max_runtime) in tst_run_tcases()
1712 results->max_runtime = multiply_runtime(tst_test->max_runtime); in tst_run_tcases()
1716 if (tst_test->test_variants) in tst_run_tcases()
1717 test_variants = tst_test->test_variants; in tst_run_tcases()
1720 if (tst_test->all_filesystems) in tst_run_tcases()