remove queue data structure and begin to implement basic chroot script for testing
This commit is contained in:
@@ -30,17 +30,22 @@
|
||||
void
|
||||
test_is_process_root(void)
|
||||
{
|
||||
CU_ASSERT(is_process_root() == 0);
|
||||
if (is_process_root() != 0) {
|
||||
CU_FAIL("is_process_root() with UID != 0 failed");
|
||||
}
|
||||
else if (is_process_root() == 0) {
|
||||
CU_PASS("is_process_root() with UID != 0 passed");
|
||||
}
|
||||
}
|
||||
|
||||
uid_t saved_uid = getuid();
|
||||
setuid(0);
|
||||
CU_ASSERT(is_process_root() == 1);
|
||||
|
||||
setuid((int)saved_uid);
|
||||
void
|
||||
test_init_config(void)
|
||||
{
|
||||
CU_ASSERT_TRUE(init_config());
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(void)
|
||||
{
|
||||
if (CUE_SUCCESS != CU_initialize_registry()) {
|
||||
return CU_get_error();
|
||||
@@ -48,6 +53,31 @@ main()
|
||||
|
||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||
|
||||
CU_pSuite runtime_tests = CU_add_suite("Runtime Functions Suite", NULL, NULL);
|
||||
if (! runtime_tests) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
CU_pSuite config_tests = CU_add_suite("Configuration Functions Suite", NULL, NULL);
|
||||
if (! config_tests) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
if (! CU_add_test(runtime_tests, "test of is_process_root()", test_is_process_root)) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
if (! CU_add_test(config_tests, "test of init_config()", test_init_config)) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CU_basic_run_tests();
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user