void test_setup(int i) { #ifdef UCLINUX i = i + 2; #endif switch (i) { case 0: break; case 1: header.version = _LINUX_CAPABILITY_VERSION; header.pid = getpid(); break; case 2: header.version = 0; header.pid = getpid(); break; case 3: header.version = _LINUX_CAPABILITY_VERSION; header.pid = -1; break; case 4: header.version = _LINUX_CAPABILITY_VERSION; header.pid = tst_get_unused_pid(cleanup); break; } }
/* setup() - performs all ONE TIME setup for this test */ void setup(void) { unused_pid = tst_get_unused_pid(cleanup); TEST_PAUSE; }
void setup(void) { TEST_PAUSE; tst_tmpdir(); unused_tid = tst_get_unused_pid(cleanup); }
void setup(void) { tst_require_root(NULL); unused_pid = tst_get_unused_pid(cleanup); TEST_PAUSE; }
/* * setup() - performs all ONE TIME setup for this test. */ void setup(void) { unused_pid = tst_get_unused_pid(cleanup); tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; }
void setup(void) { /* Capture signals if any */ /* Create temporary directories */ TEST_PAUSE; tst_tmpdir(); unused_tid = tst_get_unused_pid(cleanup); }
/* setup() - performs all ONE TIME setup for this test */ void setup(void) { unused_pid = tst_get_unused_pid(cleanup); /* capture signals tst_sig(FORK, DEF_HANDLER, cleanup); */ /* set the expected errnos... */ TEST_EXP_ENOS(exp_enos); TEST_PAUSE; }
static void test_invalid_pid(void) { pid_t invalid_pid = -1; tst_resm(TINFO, "test_invalid_pid -1"); TEST(ltp_syscall(__NR_migrate_pages, invalid_pid, sane_max_node, sane_old_nodes, sane_new_nodes)); check_ret(-1); check_errno(ESRCH); tst_resm(TINFO, "test_invalid_pid unused pid"); invalid_pid = tst_get_unused_pid(cleanup); TEST(ltp_syscall(__NR_migrate_pages, invalid_pid, sane_max_node, sane_old_nodes, sane_new_nodes)); check_ret(-1); check_errno(ESRCH); }
static void setup(void) { tst_require_root(NULL); uid = geteuid(); ncpus = tst_ncpus_max(); /* Current mask */ mask = CPU_ALLOC(ncpus); if (mask == NULL) tst_brkm(TBROK | TERRNO, cleanup, "CPU_ALLOC(%ld) failed", ncpus); mask_size = CPU_ALLOC_SIZE(ncpus); if (sched_getaffinity(0, mask_size, mask) < 0) tst_brkm(TBROK | TERRNO, cleanup, "sched_getaffinity() failed"); /* Mask with one more cpu than available on the system */ emask = CPU_ALLOC(ncpus + 1); if (emask == NULL) tst_brkm(TBROK | TERRNO, cleanup, "CPU_ALLOC(%ld) failed", ncpus + 1); emask_size = CPU_ALLOC_SIZE(ncpus + 1); CPU_ZERO_S(emask_size, emask); CPU_SET_S(ncpus, emask_size, emask); privileged_pid = tst_fork(); if (privileged_pid == 0) { pause(); exit(0); } else if (privileged_pid < 0) { tst_brkm(TBROK | TERRNO, cleanup, "fork() failed"); } /* Dropping the root privileges */ ltpuser = getpwnam(nobody_uid); if (ltpuser == NULL) tst_brkm(TBROK | TERRNO, cleanup, "getpwnam failed for user id %s", nobody_uid); SAFE_SETEUID(cleanup, ltpuser->pw_uid); /* this pid is not used by the OS */ free_pid = tst_get_unused_pid(cleanup); }
/* setup() - performs all ONE TIME setup for this test */ void setup(void) { /* * Initialize scheduling parameter structure to use with * sched_setscheduler() */ struct sched_param p = { 1 }; tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* Change scheduling policy to SCHED_RR */ if ((sched_setscheduler(0, SCHED_RR, &p)) == -1) { tst_brkm(TBROK, cleanup, "sched_setscheduler() failed"); } unused_pid = tst_get_unused_pid(cleanup); }