2001-04-24 Joel Sherrill <joel@OARcorp.com>

* psxfile01/test.c, psxfile01/psxfile01.scn : Added test case for
	open, write, reopen, append twice from Andrew Bythell
	<abythell@nortelnetworks.com> that tripped an initialization
	problem in the IMFS.
This commit is contained in:
Joel Sherrill
2001-04-24 23:04:59 +00:00
parent 126405d9ef
commit b2a1ea3a52
6 changed files with 112 additions and 0 deletions

View File

@@ -1,3 +1,10 @@
2001-04-24 Joel Sherrill <joel@OARcorp.com>
* psxfile01/test.c, psxfile01/psxfile01.scn : Added test case for
open, write, reopen, append twice from Andrew Bythell
<abythell@nortelnetworks.com> that tripped an initialization
problem in the IMFS.
2001-04-20 Joel Sherrill <joel@OARcorp.com> 2001-04-20 Joel Sherrill <joel@OARcorp.com>
* psx04/init.c, psx04/psx04.scn, psx07/init.c, psx07/psx07.scn, * psx04/init.c, psx04/psx04.scn, psx07/init.c, psx07/psx07.scn,

View File

@@ -197,5 +197,12 @@ truncate /tmp to length of 0 should fail with EISDIR
........john (file 0) ........john (file 0)
........j (file 0) ........j (file 0)
*************** End of Dump *************** *************** End of Dump ***************
Writing First File
Writing Second File
(0)this is a test line
this is a test line
(0)this is a test line
this is a test line
*** END OF FILE TEST 1 *** *** END OF FILE TEST 1 ***

View File

@@ -35,6 +35,8 @@
#include <rtems.h> #include <rtems.h>
#include <rtems/libio.h> #include <rtems/libio.h>
void test_case_reopen_append(void);
char test_write_buffer[ 1024 ]; char test_write_buffer[ 1024 ];
/* /*
@@ -498,8 +500,48 @@ int main(
rtems_status = rtems_io_register_name( "/dev/console", 0, 0 ); rtems_status = rtems_io_register_name( "/dev/console", 0, 0 );
test_case_reopen_append();
printf( "*** END OF FILE TEST 1 ***\n" ); printf( "*** END OF FILE TEST 1 ***\n" );
exit( 0 ); exit( 0 );
} }
/*
* Open/Create a File and write to it
*
* Test case submitted by Andrew Bythell <abythell@nortelnetworks.com>.
*
*/
void test_file (char *filename, char *mode);
void test_case_reopen_append(void)
{
printf ("Writing First File\n");
test_file ("/one.txt", "a");
test_file ("/one.txt", "a");
/* but not the second time - this will insert junk.
the number of ^@'s seems to equal the number of
actual characters in the file */
printf ("Writing Second File\n");
test_file ("/two.txt", "a");
test_file ("/two.txt", "a");
test_cat( "/one.txt", 0, 1024 );
test_cat( "/two.txt", 0, 1024 );
}
void test_file (char *filename, char *mode)
{
FILE *fp;
fp = fopen (filename, mode);
if (!fp)
perror ("fopen");
fprintf (fp, "this is a test line\n");
if (fclose (fp))
perror ("fclose");
}

View File

@@ -1,3 +1,10 @@
2001-04-24 Joel Sherrill <joel@OARcorp.com>
* psxfile01/test.c, psxfile01/psxfile01.scn : Added test case for
open, write, reopen, append twice from Andrew Bythell
<abythell@nortelnetworks.com> that tripped an initialization
problem in the IMFS.
2001-04-20 Joel Sherrill <joel@OARcorp.com> 2001-04-20 Joel Sherrill <joel@OARcorp.com>
* psx04/init.c, psx04/psx04.scn, psx07/init.c, psx07/psx07.scn, * psx04/init.c, psx04/psx04.scn, psx07/init.c, psx07/psx07.scn,

View File

@@ -197,5 +197,12 @@ truncate /tmp to length of 0 should fail with EISDIR
........john (file 0) ........john (file 0)
........j (file 0) ........j (file 0)
*************** End of Dump *************** *************** End of Dump ***************
Writing First File
Writing Second File
(0)this is a test line
this is a test line
(0)this is a test line
this is a test line
*** END OF FILE TEST 1 *** *** END OF FILE TEST 1 ***

View File

@@ -35,6 +35,8 @@
#include <rtems.h> #include <rtems.h>
#include <rtems/libio.h> #include <rtems/libio.h>
void test_case_reopen_append(void);
char test_write_buffer[ 1024 ]; char test_write_buffer[ 1024 ];
/* /*
@@ -498,8 +500,48 @@ int main(
rtems_status = rtems_io_register_name( "/dev/console", 0, 0 ); rtems_status = rtems_io_register_name( "/dev/console", 0, 0 );
test_case_reopen_append();
printf( "*** END OF FILE TEST 1 ***\n" ); printf( "*** END OF FILE TEST 1 ***\n" );
exit( 0 ); exit( 0 );
} }
/*
* Open/Create a File and write to it
*
* Test case submitted by Andrew Bythell <abythell@nortelnetworks.com>.
*
*/
void test_file (char *filename, char *mode);
void test_case_reopen_append(void)
{
printf ("Writing First File\n");
test_file ("/one.txt", "a");
test_file ("/one.txt", "a");
/* but not the second time - this will insert junk.
the number of ^@'s seems to equal the number of
actual characters in the file */
printf ("Writing Second File\n");
test_file ("/two.txt", "a");
test_file ("/two.txt", "a");
test_cat( "/one.txt", 0, 1024 );
test_cat( "/two.txt", 0, 1024 );
}
void test_file (char *filename, char *mode)
{
FILE *fp;
fp = fopen (filename, mode);
if (!fp)
perror ("fopen");
fprintf (fp, "this is a test line\n");
if (fclose (fp))
perror ("fclose");
}