summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.distdep46
-rw-r--r--test/big.c62
2 files changed, 84 insertions, 24 deletions
diff --git a/test/.distdep b/test/.distdep
index 2b28ca4..020d41a 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -388,29 +388,6 @@ shtype.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
-big.o: \
- big.c \
- ../src/hdf5.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Ipublic.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Epublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h \
- ../src/H5private.h
links.o: \
links.c \
../src/hdf5.h \
@@ -494,3 +471,26 @@ mtime.o: \
../src/H5Spublic.h \
../src/H5Tpublic.h \
../src/H5private.h
+big.o: \
+ big.c \
+ ../src/hdf5.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h \
+ ../src/H5private.h
diff --git a/test/big.c b/test/big.c
index c5aadd6..1ad79a2 100644
--- a/test/big.c
+++ b/test/big.c
@@ -92,6 +92,61 @@ is_sparse(void)
/*-------------------------------------------------------------------------
+ * Function: enough_room
+ *
+ * Purpose: Tries to create a bunch of sparse files to see if quotas will
+ * get in the way. Some systems also have problems opening
+ * enough files and we'll check that too.
+ *
+ * Return: Success: Non-zero
+ *
+ * Failure: zero
+ *
+ * Programmer: Robb Matzke
+ * Thursday, August 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+enough_room(void)
+{
+ int ret_value=0;
+ int fd[68];
+ size_t i, size = (size_t)1 << 30;
+ char name[32];
+
+ /* Initialize file descriptors */
+ for (i=0; i<NELMTS(fd); i++) fd[i] = -1;
+
+ /* Create files */
+ for (i=0; i<NELMTS(fd); i++) {
+ sprintf(name, FNAME, i);
+ if ((fd[i]=open(name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
+ goto done;
+ }
+ if ((ssize_t)size != lseek(fd[i], size, SEEK_SET)) {
+ goto done;
+ }
+ if (1!=write(fd[i], "X", 1)) {
+ goto done;
+ }
+ }
+ ret_value = 1;
+
+ done:
+ for (i=0; i<NELMTS(fd) && fd[i]>=0; i++) {
+ sprintf(name, FNAME, i);
+ close(fd[i]);
+ unlink(name);
+ }
+
+ return ret_value;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: writer
*
* Purpose: Creates a *big* dataset.
@@ -327,11 +382,16 @@ main (void)
* We shouldn't run this test if the file system doesn't support holes
* because we would generate multi-gigabyte files.
*/
+ puts("Checking if file system is adequate for this test...");
if (!is_sparse()) {
puts("Test skipped because file system does not support holes.");
exit(0);
}
-
+ if (!enough_room()) {
+ puts("Test skipped because of quota (file size or num open files).");
+ exit(0);
+ }
+
/* Set the error handler */
H5Eset_auto (display_error_cb, NULL);