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

            Line data    Source code
       1              : #include "sute.h"
       2              : 
       3            1 : Return prepare(void)
       4              : {
       5            1 :         INITTEST;
       6              : 
       7            1 :         const char *command = NULL;
       8              : 
       9            1 :         char path[PATH_MAX] = {0};
      10              : 
      11            1 :         ASSERT(SUCCESS == get_origin_dir(path,sizeof(path)));
      12              : 
      13            1 :         ASSERT(SUCCESS == set_environment_variable("ORIGIN_DIR",path));
      14              : 
      15            1 :         ASSERT(SUCCESS == create_tmpdir(path,sizeof(path)));
      16              : 
      17            1 :         ASSERT(SUCCESS == set_environment_variable("TMPDIR",path));
      18              : 
      19            1 :         ASSERT(SUCCESS == set_environment_variable("BINDIR",path));
      20              : 
      21            1 :         ASSERT(SUCCESS == extract_current_executable_directory_name(path,sizeof(path)));
      22              : 
      23            1 :         ASSERT(SUCCESS == set_environment_variable("ENVIRONMENT",path));
      24              : 
      25            1 :         ASSERT(SUCCESS == set_environment_variable("TESTING","true"));
      26              : 
      27            1 :         ASSERT(SUCCESS == execute_and_set_variable("DBNAME","echo \"$(hostname).db\"",0));
      28              : 
      29            1 :         command = "mkdir -p ${TMPDIR}/tests/examples/diffs/;"
      30              :                 "cp -a $ORIGIN_DIR/tests/examples/diffs/diff* ${TMPDIR}/tests/examples/diffs/;"
      31              :                 "cp -a $ORIGIN_DIR/tests/examples/*apos* ${TMPDIR}/tests/examples/;"
      32              :                 "cp -a $ORIGIN_DIR/tests/examples/levels ${TMPDIR}/tests/examples/;"
      33              :                 "cp -a $ORIGIN_DIR/tests/examples/4 ${TMPDIR}/tests/examples/;"
      34              :                 "cp -a $ORIGIN_DIR/tests/templates/0015_database_v*.db ${TMPDIR}/tests/;"
      35              :                 "mkdir -p ${TMPDIR}/.builds;"
      36              :                 "test -d $ORIGIN_DIR/.builds/${ENVIRONMENT} && cp -a $ORIGIN_DIR/.builds/${ENVIRONMENT} ${TMPDIR}/.builds/;"
      37              :                 "test -f $ORIGIN_DIR/.builds/${ENVIRONMENT}/precizer && cp -a $ORIGIN_DIR/.builds/${ENVIRONMENT}/precizer ${TMPDIR};"
      38              :                 "test -d $ORIGIN_DIR/tests/examples/long && cp -a $ORIGIN_DIR/tests/examples/long ${TMPDIR}/tests/examples/;"
      39              :                 "true";
      40              : 
      41            1 :         ASSERT(SUCCESS == external_call(command,COMPLETED,ALLOW_BOTH));
      42              : 
      43            1 :         bool file_exists = false;
      44              : 
      45            1 :         create(char,absolute_path);
      46              : 
      47            1 :         const char *filename = "precizer";
      48              : 
      49            1 :         ASSERT(SUCCESS == construct_path(filename,absolute_path));
      50              : 
      51            1 :         ASSERT(SUCCESS == check_file_exists(&file_exists,getcstring(absolute_path)));
      52              : 
      53            1 :         del(absolute_path);
      54              : 
      55            1 :         ASSERT(file_exists == true);
      56              : 
      57              :         /* Enable UTF-8 */
      58              : #if 0
      59              :         ASSERT(SUCCESS == set_environment_variable("LC_ALL","C.UTF-8"));
      60              :         ASSERT(SUCCESS == set_environment_variable("LANG","C.UTF-8"));
      61              : #endif
      62              : 
      63            1 :         return(status);
      64              : }
        

Generated by: LCOV version 2.0-1