Branch data 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/fixtures/diffs/;"
30 : : "cp -a $ORIGIN_DIR/tests/fixtures/diffs/diff* ${TMPDIR}/tests/fixtures/diffs/;"
31 : : "cp -a $ORIGIN_DIR/tests/fixtures/*apos* ${TMPDIR}/tests/fixtures/;"
32 : : "cp -a $ORIGIN_DIR/tests/fixtures/levels ${TMPDIR}/tests/fixtures/;"
33 : : "cp -a $ORIGIN_DIR/tests/fixtures/4 ${TMPDIR}/tests/fixtures/;"
34 : : "cp -a $ORIGIN_DIR/tests/fixtures/ignore_include_cases ${TMPDIR}/tests/fixtures/;"
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/fixtures/long && cp -a $ORIGIN_DIR/tests/fixtures/long ${TMPDIR}/tests/fixtures/;"
39 : : "true";
40 : :
41 [ + - + - ]: 1 : ASSERT(SUCCESS == external_call(command,NULL,NULL,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 : : }
|