/* * unit-tests.c - Unit tests for libglacier * * This file is part of Glacier. * * Glacier is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Glacier. If * not, see . */ #include #include #include #include "../include/config.h" #include "../include/log.h" #include "../include/pkgops.h" #include "../include/runtime.h" #include "../include/security.h" #include void test_is_process_root(void) { CU_ASSERT(is_process_root() == 0); uid_t saved_uid = getuid(); setuid(0); CU_ASSERT(is_process_root() == 1); setuid((int)saved_uid); } int main() { if (CUE_SUCCESS != CU_initialize_registry()) { return CU_get_error(); } CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); return CU_get_error(); }