From c7fe7382279c1c109d03216115df5f53d34bce96 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 2 Aug 2019 12:45:03 -0500 Subject: Changed the external files to a directory (extern_env_dir) to avoid possible conflict in daily test on jelly. --- test/external_common.c | 4 ++-- test/external_common.h | 1 - test/external_env.c | 33 ++++++++++++++++++++------------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/test/external_common.c b/test/external_common.c index c9b6584..9e759cd 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -60,7 +60,7 @@ reset_raw_data_files(hbool_t is_env) /* Open file */ if(is_env) - HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1); + HDsprintf(filename, "extern_env_dir%sextern_env_%lur.raw", H5_DIR_SEPS, (unsigned long)i + 1); else HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) @@ -97,7 +97,7 @@ reset_raw_data_files(hbool_t is_env) /* Open file */ if(is_env) - HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1); + HDsprintf(filename, "extern_env_dir%sextern_env_%luw.raw", H5_DIR_SEPS, (unsigned long)i + 1); else HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) diff --git a/test/external_common.h b/test/external_common.h index 304f3fb..a99ba48 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -30,7 +30,6 @@ static const char *EXT_FNAME[] = { "extern_4", "extern_dir/file_1", "extern_5", - "extern_env_dir/file_2", NULL }; diff --git a/test/external_env.c b/test/external_env.c index fca5458..484b3ea4 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -16,6 +16,11 @@ */ #include "external_common.h" +const static char *EXT_ENV_FNAME[] = { + "extern_env_dir/file_2", + NULL +}; + /*------------------------------------------------------------------------- * Function: test_path_env @@ -56,10 +61,8 @@ test_path_env(hid_t fapl) TESTING("prefix in HDF5_EXTFILE_PREFIX"); - if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR; + h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename)); - h5_fixname(EXT_FNAME[6], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -73,7 +76,7 @@ test_path_env(hid_t fapl) if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) TEST_ERROR for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1); + HDsnprintf(filename, sizeof(filename), "extern_env_%dr.raw", (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -158,6 +161,9 @@ main(void) if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR; + /* Test with old & new format groups */ for(latest_format = FALSE; latest_format <= TRUE; latest_format++) { hid_t current_fapl_id = -1; @@ -183,16 +189,16 @@ main(void) HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(EXT_FNAME, fapl_id_old)) { - HDremove("extern_env_1r.raw"); - HDremove("extern_env_2r.raw"); - HDremove("extern_env_3r.raw"); - HDremove("extern_env_4r.raw"); + if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) { + char filename[1024]; /* file name */ + int i; - HDremove("extern_env_1w.raw"); - HDremove("extern_env_2w.raw"); - HDremove("extern_env_3w.raw"); - HDremove("extern_env_4w.raw"); + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "extern_env_dir%sextern_env_%dr.raw", H5_DIR_SEPS, i + 1); + HDremove(filename); + HDsnprintf(filename, sizeof(filename), "extern_env_dir%sextern_env_%dw.raw", H5_DIR_SEPS, i + 1); + HDremove(filename); + } HDrmdir("extern_env_dir"); } /* end if */ @@ -206,6 +212,7 @@ error: H5Pclose(fapl_id_new); H5Gclose(gid); } H5E_END_TRY; + nerrors = MAX(1, nerrors); printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; -- cgit v0.12