Ignore:
Timestamp:
Apr 24, 2001, 11:04:59 PM (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
eb22ebe
Parents:
126405d9
Message:

2001-04-24 Joel Sherrill <joel@…>

  • psxfile01/test.c, psxfile01/psxfile01.scn : Added test case for

open, write, reopen, append twice from Andrew Bythell
<abythell@…> that tripped an initialization
problem in the IMFS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxfile01/test.c

    r126405d9 rb2a1ea3  
    3535#include <rtems.h>
    3636#include <rtems/libio.h>
     37
     38void test_case_reopen_append(void);
    3739
    3840char test_write_buffer[ 1024 ];
     
    499501  rtems_status = rtems_io_register_name( "/dev/console", 0, 0 );
    500502
     503  test_case_reopen_append();
     504
    501505  printf( "*** END OF FILE TEST 1 ***\n" );
    502506  exit( 0 );
    503507}
    504508
    505 
     509/*
     510 *  Open/Create a File and write to it
     511 *
     512 *  Test case submitted by Andrew Bythell <abythell@nortelnetworks.com>.
     513 *
     514 */
     515
     516void test_file (char *filename, char *mode);
     517
     518void test_case_reopen_append(void)
     519{
     520  printf ("Writing First File\n");
     521  test_file ("/one.txt", "a");
     522  test_file ("/one.txt", "a");
     523
     524  /* but not the second time - this will insert junk.
     525     the number of ^@'s seems to equal the number of
     526     actual characters in the file */
     527
     528  printf ("Writing Second File\n");
     529  test_file ("/two.txt", "a");
     530  test_file ("/two.txt", "a");
     531
     532  test_cat( "/one.txt", 0, 1024 );
     533  test_cat( "/two.txt", 0, 1024 );
     534}
     535
     536void test_file (char *filename, char *mode)
     537{
     538  FILE *fp;
     539  fp = fopen (filename, mode);
     540  if (!fp)
     541      perror ("fopen");
     542  fprintf (fp, "this is a test line\n");
     543  if (fclose (fp))
     544      perror ("fclose");
     545}
     546
     547
Note: See TracChangeset for help on using the changeset viewer.