mirror of git://sourceware.org/git/glibc.git
Update.
* posix/tst-preadwrite.c: Allow parallel execution of tst-preadwrite and tst-preadwrite64.
This commit is contained in:
parent
ad92208d51
commit
0a5503211c
|
|
@ -1,5 +1,8 @@
|
||||||
2000-05-26 Ulrich Drepper <drepper@redhat.com>
|
2000-05-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* posix/tst-preadwrite.c: Allow parallel execution of
|
||||||
|
tst-preadwrite and tst-preadwrite64.
|
||||||
|
|
||||||
* posix/Makefile (tests): Add tst-truncate and tst-truncate64.
|
* posix/Makefile (tests): Add tst-truncate and tst-truncate64.
|
||||||
* posix/tst-truncate.c: New file.
|
* posix/tst-truncate.c: New file.
|
||||||
* posix/tst-truncate64.c: New file.
|
* posix/tst-truncate64.c: New file.
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,12 @@ do_prepare (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char name_len;
|
char name_len;
|
||||||
|
|
||||||
|
#define FNAME FNAME2(TRUNCATE)
|
||||||
|
#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
|
||||||
|
|
||||||
name_len = strlen (test_dir);
|
name_len = strlen (test_dir);
|
||||||
name = malloc (name_len + sizeof ("/preadwriteXXXXXX"));
|
name = malloc (name_len + sizeof (FNAME));
|
||||||
mempcpy (mempcpy (name, test_dir, name_len),
|
mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
|
||||||
"/preadwriteXXXXXX", sizeof ("/preadwriteXXXXXX"));
|
|
||||||
add_temp_file (name);
|
add_temp_file (name);
|
||||||
|
|
||||||
/* Open our test file. */
|
/* Open our test file. */
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,12 @@ do_prepare (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char name_len;
|
char name_len;
|
||||||
|
|
||||||
|
#define FNAME FNAME2(TRUNCATE)
|
||||||
|
#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
|
||||||
|
|
||||||
name_len = strlen (test_dir);
|
name_len = strlen (test_dir);
|
||||||
name = malloc (name_len + sizeof ("/truncateXXXXXX"));
|
name = malloc (name_len + sizeof (FNAME));
|
||||||
mempcpy (mempcpy (name, test_dir, name_len),
|
mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
|
||||||
"/truncateXXXXXX", sizeof ("/truncateXXXXXX"));
|
|
||||||
add_temp_file (name);
|
add_temp_file (name);
|
||||||
|
|
||||||
/* Open our test file. */
|
/* Open our test file. */
|
||||||
|
|
@ -73,7 +75,6 @@ do_test (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char buf[1000];
|
char buf[1000];
|
||||||
int i;
|
|
||||||
|
|
||||||
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
||||||
|
|
||||||
|
|
@ -85,35 +86,43 @@ do_test (int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
if (FTRUNCATE (fd, 800) < 0)
|
if (FTRUNCATE (fd, 800) < 0)
|
||||||
error (EXIT_FAILURE, errno, "size reduction with ftruncate failed");
|
error (EXIT_FAILURE, errno, "size reduction with %s failed",
|
||||||
|
STRINGIFY (FTRUNCATE));
|
||||||
|
|
||||||
if (fstat (fd, &st) < 0 || st.st_size != 800)
|
if (fstat (fd, &st) < 0 || st.st_size != 800)
|
||||||
error (EXIT_FAILURE, 0, "size after reduction with ftruncate incorrect");
|
error (EXIT_FAILURE, 0, "size after reduction with %s incorrect",
|
||||||
|
STRINGIFY (FTRUNCATE));
|
||||||
|
|
||||||
/* The following test covers more than POSIX. POSIX does not require
|
/* The following test covers more than POSIX. POSIX does not require
|
||||||
that ftruncate() can increase the file size. But we are testing
|
that ftruncate() can increase the file size. But we are testing
|
||||||
Unix systems. */
|
Unix systems. */
|
||||||
if (FTRUNCATE (fd, 1200) < 0)
|
if (FTRUNCATE (fd, 1200) < 0)
|
||||||
error (EXIT_FAILURE, errno, "size increase with ftruncate failed");
|
error (EXIT_FAILURE, errno, "size increase with %s failed",
|
||||||
|
STRINGIFY (FTRUNCATE));
|
||||||
|
|
||||||
if (fstat (fd, &st) < 0 || st.st_size != 1200)
|
if (fstat (fd, &st) < 0 || st.st_size != 1200)
|
||||||
error (EXIT_FAILURE, 0, "size after increase with ftruncate incorrect");
|
error (EXIT_FAILURE, 0, "size after increase with %s incorrect",
|
||||||
|
STRINGIFY (FTRUNCATE));
|
||||||
|
|
||||||
|
|
||||||
if (TRUNCATE (name, 800) < 0)
|
if (TRUNCATE (name, 800) < 0)
|
||||||
error (EXIT_FAILURE, errno, "size reduction with truncate failed");
|
error (EXIT_FAILURE, errno, "size reduction with %s failed",
|
||||||
|
STRINGIFY (TRUNCATE));
|
||||||
|
|
||||||
if (fstat (fd, &st) < 0 || st.st_size != 800)
|
if (fstat (fd, &st) < 0 || st.st_size != 800)
|
||||||
error (EXIT_FAILURE, 0, "size after reduction with truncate incorrect");
|
error (EXIT_FAILURE, 0, "size after reduction with %s incorrect",
|
||||||
|
STRINGIFY (TRUNCATE));
|
||||||
|
|
||||||
/* The following test covers more than POSIX. POSIX does not require
|
/* The following test covers more than POSIX. POSIX does not require
|
||||||
that truncate() can increase the file size. But we are testing
|
that truncate() can increase the file size. But we are testing
|
||||||
Unix systems. */
|
Unix systems. */
|
||||||
if (TRUNCATE (name, 1200) < 0)
|
if (TRUNCATE (name, 1200) < 0)
|
||||||
error (EXIT_FAILURE, errno, "size increase with truncate failed");
|
error (EXIT_FAILURE, errno, "size increase with %s failed",
|
||||||
|
STRINGIFY (TRUNCATE));
|
||||||
|
|
||||||
if (fstat (fd, &st) < 0 || st.st_size != 1200)
|
if (fstat (fd, &st) < 0 || st.st_size != 1200)
|
||||||
error (EXIT_FAILURE, 0, "size after increase with truncate incorrect");
|
error (EXIT_FAILURE, 0, "size after increase with %s incorrect",
|
||||||
|
STRINGIFY (TRUNCATE));
|
||||||
|
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue