mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-04-25 09:54:44 +02:00
Safer output cleaning for TREXIO_TEXT unit tests
This commit is contained in:
parent
bdf770d617
commit
9cbc162b47
@ -5,7 +5,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_del.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_delete_group (const char* file_name, const back_end_t backend) {
|
||||
|
||||
|
@ -26,11 +26,11 @@ int main() {
|
||||
assert (rc == 0);
|
||||
}
|
||||
|
||||
rc = system("rm -rf test_all.dir");
|
||||
rc = system("rm -f -- test_all.dir/*.txt test_all.dir/*.txt.size test_all.dir/.lock && rm -fd -- test_all.dir");
|
||||
assert (rc == 0);
|
||||
test_write("test_all.dir", TREXIO_TEXT);
|
||||
test_read ("test_all.dir", TREXIO_TEXT);
|
||||
rc = system("rm -rf test_all.dir");
|
||||
rc = system("rm -f -- test_all.dir/*.txt test_all.dir/*.txt.size test_all.dir/.lock && rm -fd -- test_all.dir");
|
||||
assert (rc == 0);
|
||||
|
||||
return 0;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_HDF5
|
||||
#define TREXIO_FILE "test_determinant.h5"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE
|
||||
#define SIZE 100
|
||||
#define N_CHUNKS 5
|
||||
#define STATE_TEST 2
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_determinant.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
#define SIZE 100
|
||||
#define N_CHUNKS 5
|
||||
#define STATE_TEST 2
|
||||
@ -312,6 +312,7 @@ int main(){
|
||||
/*============== Test launcher ================*/
|
||||
|
||||
int rc;
|
||||
|
||||
rc = system(RM_COMMAND);
|
||||
assert (rc == 0);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_dset_f.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_dset (const char* file_name, const back_end_t backend) {
|
||||
|
||||
@ -40,7 +40,7 @@ static int test_write_dset (const char* file_name, const back_end_t backend) {
|
||||
// write numerical attribute in an empty file
|
||||
rc = trexio_write_nucleus_num(file, num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
|
||||
// write numerical dataset in a file
|
||||
rc = trexio_write_nucleus_coord(file, coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
@ -144,5 +144,3 @@ int main(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_dset_i.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_dset (const char* file_name, const back_end_t backend) {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_dset_sparse.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
#define SIZE 100
|
||||
#define N_CHUNKS 5
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_dset_s.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_dset_str (const char* file_name, const back_end_t backend) {
|
||||
|
||||
@ -39,7 +39,7 @@ static int test_write_dset_str (const char* file_name, const back_end_t backend)
|
||||
// write numerical attribute in an empty file
|
||||
rc = trexio_write_nucleus_num(file, num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
|
||||
// write dataset of string in the file (including FAKE statements)
|
||||
int max_str_len = 16;
|
||||
rc = trexio_write_nucleus_label(file, labels, max_str_len);
|
||||
@ -153,5 +153,3 @@ int main(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_num.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_num (const char* file_name, const back_end_t backend) {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_safe_dset_f.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_dset (const char* file_name, const back_end_t backend) {
|
||||
|
||||
@ -41,7 +41,7 @@ static int test_write_dset (const char* file_name, const back_end_t backend) {
|
||||
// write numerical attribute in an empty file
|
||||
rc = trexio_write_nucleus_num(file, num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
|
||||
/* write numerical dataset with an unsafe dimension
|
||||
* this should return TREXIO_UNSAFE_ARRAY_DIM indicating
|
||||
* that access beyong allocated memory is likely to occur */
|
||||
@ -161,5 +161,3 @@ int main(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_str.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write_str (const char* file_name, const back_end_t backend) {
|
||||
|
||||
@ -129,5 +129,3 @@ int main(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_open.dir"
|
||||
#define TREXIO_VOID "non_existing_" TREXIO_FILE
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
|
||||
static int test_open_w (const char* file_name, const back_end_t backend) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define TEST_BACKEND TREXIO_TEXT
|
||||
#define TREXIO_FILE "test_over.dir"
|
||||
#define RM_COMMAND "rm -rf " TREXIO_FILE
|
||||
#define RM_COMMAND "rm -f -- " TREXIO_FILE "/*.txt " TREXIO_FILE "/*.txt.size " TREXIO_FILE "/.lock && rm -fd -- " TREXIO_FILE
|
||||
|
||||
static int test_write (const char* file_name, const back_end_t backend) {
|
||||
|
||||
|
@ -14,12 +14,12 @@ program test_trexio
|
||||
|
||||
rc = trexio_info()
|
||||
|
||||
call system('rm -rf -- test_write_f.dir')
|
||||
call system('rm -f -- test_write_f.dir/*.txt test_write_f.dir/*.txt.size test_write_f.dir/.lock && rm -fd -- test_write_f.dir')
|
||||
print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)'
|
||||
call test_write('test_write_f.dir', TREXIO_TEXT)
|
||||
print *, 'call test_read(''test_write_f.dir'', TREXIO_TEXT)'
|
||||
call test_read('test_write_f.dir', TREXIO_TEXT)
|
||||
call system('rm -rf -- test_write_f.dir')
|
||||
call system('rm -f -- test_write_f.dir/*.txt test_write_f.dir/*.txt.size test_write_f.dir/.lock && rm -fd -- test_write_f.dir')
|
||||
|
||||
call test_read_void('test_write_f.dir', TREXIO_TEXT)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user