LCOV - code coverage report
Current view: top level - tests/src - test0029.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 92.9 % 28 26
Test Date: 2026-01-12 05:34:38 Functions: 100.0 % 2 2

            Line data    Source code
       1              : #include "sute.h"
       2              : 
       3              : /**
       4              :  * "inaccessible" message of show_relative_path() function
       5              :  */
       6            2 : static Return test0029_1_test(void)
       7              : {
       8            2 :         INITTEST;
       9              : 
      10              :         // Create memory for the result
      11            2 :         create(char,result);
      12            2 :         create(char,pattern);
      13              : 
      14            2 :         const char *command = "cd ${TMPDIR};"
      15              :                 "mv tests/examples/ tests/examples_backup/;"
      16              :                 "cp -a tests/examples_backup/ tests/examples/;";
      17              : 
      18              :         // Preparation for tests
      19            2 :         ASSERT(SUCCESS == external_call(command,COMPLETED,ALLOW_BOTH));
      20              : 
      21            2 :         ASSERT(SUCCESS == set_environment_variable("TESTING","false"));
      22              : 
      23            2 :         const char *arguments = "--silent --database=database1.db tests/examples/diffs/diff1";
      24              : 
      25            2 :         ASSERT(SUCCESS == runit(arguments,result,COMPLETED,ALLOW_BOTH));
      26              : 
      27            2 :         if(result->length > 0)
      28              :         {
      29            0 :                 echo(STDERR,"STDOUT buffer is not empty. It contains characters: %zu\n",result->length);
      30            0 :                 status = FAILURE;
      31              :                 #if 0
      32              :                 echo(STDOUT,"%s\n",getcstring(result));
      33              :                 #endif
      34              :         }
      35              : 
      36            2 :         command = "cd ${TMPDIR};"
      37              :                 "chmod 000 tests/examples/diffs/diff1/1/AAA/ZAW/D/e/f/b_file.txt;" // Change file permitions
      38              :                 "chmod 000 tests/examples/diffs/diff1/2/AAA/BBB/CZC;"; // Change directory permitions
      39              : 
      40            2 :         ASSERT(SUCCESS == external_call(command,COMPLETED,ALLOW_BOTH));
      41              : 
      42            2 :         ASSERT(SUCCESS == set_environment_variable("TESTING","true"));
      43              : 
      44            2 :         arguments = "--update --database=database1.db tests/examples/diffs/diff1";
      45              : 
      46            2 :         ASSERT(SUCCESS == runit(arguments,result,COMPLETED,ALLOW_BOTH));
      47              : 
      48            2 :         const char *filename = "templates/0029_001.txt";
      49              : 
      50            2 :         ASSERT(SUCCESS == get_file_content(filename,pattern));
      51            2 :         ASSERT(SUCCESS == match_pattern(result,pattern,filename));
      52              : 
      53            2 :         del(pattern);
      54            2 :         del(result);
      55              : 
      56              :         // Clean up test results
      57            2 :         ASSERT(SUCCESS == external_call("cd ${TMPDIR} && "
      58              :                 "rm database1.db && "
      59              :                 "chmod -R a+rwX tests/examples/ && "
      60              :                 "rm -rf tests/examples/ && "
      61              :                 "mv tests/examples_backup/ tests/examples/",COMPLETED,ALLOW_BOTH));
      62              : 
      63            2 :         RETURN_STATUS;
      64              : }
      65              : 
      66              : /**
      67              :  *
      68              :  *
      69              :  *
      70              :  */
      71            2 : Return test0029(void)
      72              : {
      73            2 :         INITTEST;
      74              : 
      75            2 :         TEST(test0029_1_test,"\"inaccessible\" message of show_relative_path() function…");
      76              : 
      77            2 :         RETURN_STATUS;
      78              : }
        

Generated by: LCOV version 2.0-1