summaryrefslogtreecommitdiffstats
path: root/test/big.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-06 21:32:33 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-06 21:32:33 (GMT)
commitacd04a1aa67b182623f26979515ab8dd5b978f11 (patch)
tree7a65e24c03e9e2d7db021e6f89603f5bab458a78 /test/big.c
parentde875442351b3ddd204b65d371536e63de6be8ff (diff)
downloadhdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.zip
hdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.tar.gz
hdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.tar.bz2
[svn-r579] Changes since 19980806
---------------------- ./config/solaris2.5 Hopefully set up now so it honors the CC and CFLAGS variables and understands solaris cc flags. ./test/big.c Checks to see if creating lots of large sparse files exceeds the user disk quota and skips the test. It also checks that we can actually open ~64 files at once. ./doc/html/Files.html ./src/H5A.c ./src/H5Aprivate.h ./src/H5F.c ./src/H5Fpublic.h Added the H5Fflush() function which takes any object as an argument as long as the object is in some way associated with a file. This required an H5A_entof() ./src/H5.c ./src/H5Flow.c The `%a' format of HDfprintf() now allows a field width and justification flag etc, like the other formats. The old H5F_addr_print() was recoded to call HDfprintf() instead of vice versa.
Diffstat (limited to 'test/big.c')
-rw-r--r--test/big.c62
1 files changed, 61 insertions, 1 deletions
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);