diff options
author | Alexander Krutwig <alexander.krutwig@embedded-brains.de> | 2016-07-13 09:22:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-07-26 10:00:04 +0200 |
commit | 1a8fe67acf5903caacc6da2854a074ed0c4b2743 (patch) | |
tree | f7f781ee2f2e847f7f5ea12e386ef27d3be09aef /testsuites/libtests | |
parent | sptests/spextensions01: Avoid NULL pointer access (diff) | |
download | rtems-1a8fe67acf5903caacc6da2854a074ed0c4b2743.tar.bz2 |
Add Untar_FromChunk_Print() + Test
Diffstat (limited to 'testsuites/libtests')
-rw-r--r-- | testsuites/libtests/tar01/init.c | 41 | ||||
-rw-r--r-- | testsuites/libtests/tar01/tar01.doc | 1 | ||||
-rw-r--r-- | testsuites/libtests/tar01/tar01.scn | 12 |
3 files changed, 54 insertions, 0 deletions
diff --git a/testsuites/libtests/tar01/init.c b/testsuites/libtests/tar01/init.c index 54760e9e34..285c767280 100644 --- a/testsuites/libtests/tar01/init.c +++ b/testsuites/libtests/tar01/init.c @@ -31,6 +31,7 @@ const char rtems_test_name[] = "TAR 1"; rtems_task Init(rtems_task_argument argument); void test_untar_from_memory(void); void test_untar_from_file(void); +void test_untar_chunks_from_memory(void); #define TARFILE_START initial_filesystem_tar #define TARFILE_SIZE initial_filesystem_tar_size @@ -106,6 +107,44 @@ void test_untar_from_file(void) test_cat( "/dest/symlink", 0, 0 ); } +void test_untar_chunks_from_memory(void) +{ + rtems_status_code sc; + rtems_printer printer; + int rv; + Untar_ChunkContext ctx; + unsigned long counter = 0; + char *buffer = (char *)TARFILE_START; + size_t buflen = TARFILE_SIZE; + + rtems_print_printer_printf(&printer); + + /* make a directory to untar it into */ + rv = mkdir( "/dest2", 0777 ); + rtems_test_assert( rv == 0 ); + + rv = chdir( "/dest2" ); + rtems_test_assert( rv == 0 ); + + printf( "Untaring chunks from memory - " ); + Untar_ChunkContext_Init(&ctx); + do { + sc = Untar_FromChunk_Print(&ctx, &buffer[counter], (size_t)1 , &printer); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + counter ++; + } while (counter < buflen); + printf("successful\n"); + + /******************/ + printf( "========= /dest2/home/test_file =========\n" ); + test_cat( "/dest2/home/test_file", 0, 0 ); + + /******************/ + printf( "========= /dest2/symlink =========\n" ); + test_cat( "/dest2/symlink", 0, 0 ); + +} + rtems_task Init( rtems_task_argument ignored ) @@ -115,6 +154,8 @@ rtems_task Init( test_untar_from_memory(); puts( "" ); test_untar_from_file(); + puts( "" ); + test_untar_chunks_from_memory(); TEST_END(); exit( 0 ); diff --git a/testsuites/libtests/tar01/tar01.doc b/testsuites/libtests/tar01/tar01.doc index 463d6b3499..1a8151c5f2 100644 --- a/testsuites/libtests/tar01/tar01.doc +++ b/testsuites/libtests/tar01/tar01.doc @@ -14,6 +14,7 @@ directives: + Untar_FromMemory + Untar_FromFile + + Untar_ChunksFromMemory concepts: diff --git a/testsuites/libtests/tar01/tar01.scn b/testsuites/libtests/tar01/tar01.scn index 2c4d6b0c08..078cedffca 100644 --- a/testsuites/libtests/tar01/tar01.scn +++ b/testsuites/libtests/tar01/tar01.scn @@ -19,4 +19,16 @@ initial tar image. (0)This is a test of loading an RTEMS filesystem from an initial tar image. + +Untaring chunks from memory - untar: dir: home +untar: file: home/test_file (73) +successful +========= /dest2/home/test_file ========= +(0)This is a test of loading an RTEMS filesystem from an +initial tar image. + +========= /dest2/symlink ========= +(0)This is a test of loading an RTEMS filesystem from an +initial tar image. + *** END OF TAR01 TEST *** |