1997-08-10 00:47:25 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Copyright (C) 1997 National Center for Supercomputing Applications.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* Created: tstab.c
|
|
|
|
|
* Aug 7 1997
|
|
|
|
|
* Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
*
|
|
|
|
|
* Purpose:
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1997-08-16 00:53:11 +08:00
|
|
|
|
#include <testhdf5.h>
|
1997-08-10 00:47:25 +08:00
|
|
|
|
|
1997-08-16 00:53:11 +08:00
|
|
|
|
#include <H5private.h>
|
|
|
|
|
#include <H5ACprivate.h>
|
|
|
|
|
#include <H5Fprivate.h>
|
|
|
|
|
#include <H5Gprivate.h>
|
|
|
|
|
#include <H5Oprivate.h>
|
1997-08-10 00:47:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_stab
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Test symbol tables
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@viper.llnl.gov
|
|
|
|
|
* Aug 7 1997
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
test_stab (void)
|
|
|
|
|
{
|
|
|
|
|
hatom_t fid;
|
|
|
|
|
hdf5_file_t *f;
|
1997-08-13 06:46:07 +08:00
|
|
|
|
H5G_entry_t cwd, sub;
|
1997-08-10 00:47:25 +08:00
|
|
|
|
int i;
|
1997-08-13 23:37:09 +08:00
|
|
|
|
haddr_t addr;
|
1997-08-10 00:47:25 +08:00
|
|
|
|
char name[256];
|
|
|
|
|
herr_t status;
|
1997-08-13 06:46:07 +08:00
|
|
|
|
int nsyms = 5000;
|
1997-08-10 00:47:25 +08:00
|
|
|
|
|
|
|
|
|
MESSAGE (5, print_func("Testing Symbol Tables\n"););
|
|
|
|
|
|
|
|
|
|
/* create the file */
|
|
|
|
|
fid = H5Fcreate ("tstab.h5", H5ACC_OVERWRITE, 0, 0);
|
|
|
|
|
CHECK (fid, FAIL, "H5Fcreate");
|
|
|
|
|
f = H5Aatom_object (fid);
|
|
|
|
|
CHECK (f, NULL, "H5Aatom_object");
|
|
|
|
|
|
1997-08-13 06:46:07 +08:00
|
|
|
|
/*
|
|
|
|
|
* Create a directory that has so many entries that the root
|
|
|
|
|
* of the B-tree ends up splitting.
|
|
|
|
|
*/
|
1997-08-16 00:53:11 +08:00
|
|
|
|
status = H5G_new (f, NULL, NULL, "/big", nsyms*12+2, &cwd);
|
1997-08-13 06:46:07 +08:00
|
|
|
|
CHECK_I (status, "H5G_new");
|
1997-08-13 23:37:09 +08:00
|
|
|
|
addr = H5G_stab_new (f, &sub, 0);
|
|
|
|
|
CHECK_I (addr, "H5G_stab_new");
|
|
|
|
|
MESSAGE (8, print_func ("Address %lu\n", (unsigned long)addr););
|
1997-08-13 06:46:07 +08:00
|
|
|
|
|
|
|
|
|
|
1997-08-13 23:37:09 +08:00
|
|
|
|
for (i=0; i<nsyms; i++) {
|
1997-08-16 00:53:11 +08:00
|
|
|
|
sprintf (name, "%05d%05d", rand()%100000, i);
|
1997-08-10 00:47:25 +08:00
|
|
|
|
MESSAGE (8, print_func ("%s\n", name););
|
1997-08-13 06:46:07 +08:00
|
|
|
|
#if 1
|
|
|
|
|
status = H5G_insert (f, &cwd, NULL, name, &sub);
|
|
|
|
|
CHECK_I (status, "H5G_insert");
|
|
|
|
|
#else
|
|
|
|
|
status = H5G_stab_new (f, &sub, 0);
|
|
|
|
|
CHECK_I (status, "H5G_stab_new");
|
|
|
|
|
status = H5G_stab_insert (f, &cwd, name, &sub);
|
1997-08-10 00:47:25 +08:00
|
|
|
|
CHECK_I (status, "H5G_stab_insert");
|
1997-08-13 06:46:07 +08:00
|
|
|
|
#endif
|
1997-08-10 00:47:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* close the file */
|
|
|
|
|
H5Fclose (fid);
|
|
|
|
|
}
|