From 1a8fe67acf5903caacc6da2854a074ed0c4b2743 Mon Sep 17 00:00:00 2001 From: Alexander Krutwig Date: Wed, 13 Jul 2016 09:22:35 +0200 Subject: Add Untar_FromChunk_Print() + Test --- testsuites/libtests/tar01/init.c | 41 +++++++++++++++++++++++++++++++++++++ testsuites/libtests/tar01/tar01.doc | 1 + testsuites/libtests/tar01/tar01.scn | 12 +++++++++++ 3 files changed, 54 insertions(+) (limited to 'testsuites/libtests/tar01') 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 *** -- cgit v1.2.3