commit eb2c74b3fc58e3f9a8d026478fee0fe6c9c592a4
parent da7948028f98b4d68419471b13cfaabce076ccba
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 14 Jun 2022 11:20:54 +0200
Small update of the loading test
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/test_sck_load.c b/src/test_sck_load.c
@@ -181,9 +181,8 @@ test_load(struct sck* sck)
/* Write per band ks and per quadrature point ka */
FOR_EACH(iband, 0, nbands) {
const uint64_t nqpts = iband + 1;
- uint64_t iqpt;
uint64_t inode;
-
+ uint64_t iqpt;
/* Padding */
CHK(fseek(fp, (long)ALIGN_SIZE((size_t)ftell(fp), pagesize), SEEK_SET)==0);
@@ -222,7 +221,7 @@ test_load(struct sck* sck)
CHK(sck_load(sck, "nop") == RES_IO_ERR);
CHK(sck_load(sck, filename) == RES_OK);
- fclose(fp);
+ CHK(fclose(fp) == 0);
}
static void
@@ -268,7 +267,7 @@ test_load_fail(struct sck* sck)
rewind(fp);
CHK(sck_load_stream(sck, fp, NULL) == RES_BAD_ARG);
- fclose(fp);
+ CHK(fclose(fp) == 0);
/* Wrong #bands */
fp = tmpfile();
@@ -282,7 +281,7 @@ test_load_fail(struct sck* sck)
rewind(fp);
CHK(sck_load_stream(sck, fp, NULL) == RES_BAD_ARG);
- fclose(fp);
+ CHK(fclose(fp) == 0);
/* Wrong #nodes */
fp = tmpfile();
@@ -303,7 +302,10 @@ test_load_fail(struct sck* sck)
CHK(fwrite(&weight, sizeof(weight), 1, fp) == 1);
CHK(fseek(fp, (long)ALIGN_SIZE((size_t)ftell(fp), pagesize)-1, SEEK_SET) == 0);
CHK(fwrite(&byte, sizeof(byte), 1, fp) == 1); /* Positioned the EOF */
- fclose(fp);
+ rewind(fp);
+
+ CHK(sck_load_stream(sck, fp, NULL) == RES_BAD_ARG);
+ CHK(fclose(fp) == 0);
/* Wrong band boundaries */
fp = tmpfile();
@@ -333,7 +335,7 @@ test_load_fail(struct sck* sck)
rewind(fp);
CHK(sck_load_stream(sck, fp, NULL) == RES_BAD_ARG);
- fclose(fp);
+ CHK(fclose(fp) == 0);
}
static void
@@ -395,8 +397,8 @@ test_load_files(struct sck* sck, int argc, char** argv)
int
main(int argc, char** argv)
{
- struct sck* sck = NULL;
struct sck_create_args args = SCK_CREATE_ARGS_DEFAULT;
+ struct sck* sck = NULL;
(void)argc, (void)argv;
args.verbose = 1;