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 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'testsuites/libtests/tar01/init.c') 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 ); -- cgit v1.2.3