1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 3 #include "tests.h" 4 #include "umask-util.h" 5 main(int argc,char * argv[])6int main(int argc, char *argv[]) { 7 size_t n; 8 mode_t u; 9 10 test_setup_logging(LOG_DEBUG); 11 12 u = umask(0111); 13 14 n = 0; 15 RUN_WITH_UMASK(0123) { 16 assert_se(umask(000) == 0123); 17 n++; 18 } 19 20 assert_se(n == 1); 21 assert_se(umask(u) == 0111); 22 23 RUN_WITH_UMASK(0135) { 24 assert_se(umask(000) == 0135); 25 n++; 26 } 27 28 assert_se(n == 2); 29 assert_se(umask(0111) == u); 30 31 RUN_WITH_UMASK(0315) { 32 assert_se(umask(000) == 0315); 33 n++; 34 break; 35 } 36 37 assert_se(n == 3); 38 assert_se(umask(u) == 0111); 39 40 return EXIT_SUCCESS; 41 } 42