diff --git a/source/Makefile b/source/Makefile index 437475b30..8aecaa9ca 100644 --- a/source/Makefile +++ b/source/Makefile @@ -316,7 +316,7 @@ unit_test: startup unit_test.o $(python_objects) # the Python source. It doesn't require anything to be compiled, actually, as # the Makefile in tests/ will compile what is requried check: - cd tests; make check NVCC=$(NVCC) CC=$(CC) + cd tests; make check NVCC=$(NVCC) CC=$(CC) MATOM_VER=$(MATOM_VER) # The next line runs recompiles all of the routines after first cleaning the directory # all: clean run_indent python windsave2table py_wind diff --git a/source/tests/Makefile b/source/tests/Makefile index d71e7d93a..31f8161bc 100644 --- a/source/tests/Makefile +++ b/source/tests/Makefile @@ -1,10 +1,11 @@ C = gcc NVCC = +MATOM_VER = 1 TARGET = py_unit_test I_FLAGS = -I$(PYTHON)/include L_FLAGS = -L$(PYTHON)/lib -C_FLAGS = -O3 -Wall -Wno-deprecated-non-prototype +C_FLAGS = -O3 -Wall -Wno-deprecated-non-prototype -DMATOM_VER=$(MATOM_VER) CU_FLAGS = -O3 INCLUDES = diff --git a/source/tests/tests/test_define_wind.c b/source/tests/tests/test_define_wind.c index 196735e42..3b0211117 100644 --- a/source/tests/tests/test_define_wind.c +++ b/source/tests/tests/test_define_wind.c @@ -27,6 +27,8 @@ char *PYTHON_ENV; char TEST_CWD[LINELENGTH]; char ATOMIC_DATA_TARGET[LINELENGTH]; char ATOMIC_DATA_DEST[LINELENGTH]; +char ATOMIC_DATA_TARGET_DEVELOPER[LINELENGTH]; +char ATOMIC_DATA_DEST_DEVELOPER[LINELENGTH]; #define TEST_DATA_LENGTH 2056 @@ -316,7 +318,7 @@ test_shell_wind (void) WindPtr wind_cell; PlasmaPtr plasma_cell; - const int init_error = setup_model_grid ("shell", ATOMIC_DATA_DEST); + const int init_error = setup_model_grid ("shell", ATOMIC_DATA_DEST_DEVELOPER); if (init_error) { cleanup_model ("shell"); @@ -613,6 +615,7 @@ suite_init (void) perror ("Unable to find atomic data directory"); return EXIT_FAILURE; } + snprintf (ATOMIC_DATA_DEST, LINELENGTH, "%s/data", TEST_CWD); if (symlink (ATOMIC_DATA_TARGET, ATOMIC_DATA_DEST) != EXIT_SUCCESS) { @@ -625,6 +628,26 @@ suite_init (void) } } + /* Set global variables for atomic data for developers */ + snprintf (ATOMIC_DATA_TARGET_DEVELOPER, LINELENGTH, "%s/zdata", PYTHON_ENV); + if (!(stat (ATOMIC_DATA_TARGET_DEVELOPER, &sb) == EXIT_SUCCESS && S_ISDIR (sb.st_mode))) + { + perror ("Unable to find atomic data directory"); + return EXIT_FAILURE; + } + + snprintf (ATOMIC_DATA_DEST_DEVELOPER, LINELENGTH, "%s/zdata", TEST_CWD); + if (symlink (ATOMIC_DATA_TARGET_DEVELOPER, ATOMIC_DATA_DEST_DEVELOPER) != EXIT_SUCCESS) + { + /* If the symlink exists, we'll try not worry about it as if something is + * wrong with the atomic data it'll be caught later */ + if (errno != EEXIST) + { + perror ("Unable to created symbolic link for atomic data for test case"); + return EXIT_FAILURE; + } + } + /* Now initialise the things Python will need to work, and things which aren't * specific to the model being tested such as the domain allocation */ rel_mode = REL_MODE_FULL;