summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/tar01/Makefile.am5
-rw-r--r--testsuites/libtests/tar01/init.c30
2 files changed, 34 insertions, 1 deletions
diff --git a/testsuites/libtests/tar01/Makefile.am b/testsuites/libtests/tar01/Makefile.am
index d7257bc69f..8b03e59c2d 100644
--- a/testsuites/libtests/tar01/Makefile.am
+++ b/testsuites/libtests/tar01/Makefile.am
@@ -9,7 +9,7 @@ tar01_SOURCES += initial_filesystem_tar_gz.c
tar01_SOURCES += initial_filesystem_tar_gz.h
tar01_LDADD = -lrtemscpu -lz
-
+
BUILT_SOURCES =
BUILT_SOURCES += initial_filesystem_tar.c
BUILT_SOURCES += initial_filesystem_tar.h
@@ -57,6 +57,9 @@ initial_filesystem.tar:
$(MKDIR_P) initial_fs/home
(echo "This is a test of loading an RTEMS filesystem from an" ; \
echo "initial tar image.") >initial_fs/home/test_file
+ (echo "#! joel" ; \
+ echo "ls -las /dev") >initial_fs/home/test_script
+ chmod +x initial_fs/home/test_script
(cd initial_fs; \
$(LN_S) home/test_file symlink; \
$(PAX) -w -f ../initial_filesystem.tar home symlink)
diff --git a/testsuites/libtests/tar01/init.c b/testsuites/libtests/tar01/init.c
index 4bfa29c636..7d4f1b9a2a 100644
--- a/testsuites/libtests/tar01/init.c
+++ b/testsuites/libtests/tar01/init.c
@@ -46,6 +46,16 @@ void test_cat(
int length
);
+static void test_untar_check_mode(const char* file, int mode)
+{
+ struct stat sb;
+ int fmode;
+ rtems_test_assert(stat(file, &sb) == 0);
+ fmode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
+ printf(" %s: mode: %04o want: %04o\n", file, fmode, mode);
+ rtems_test_assert(fmode == mode);
+}
+
void test_untar_from_memory(void)
{
rtems_status_code sc;
@@ -66,6 +76,11 @@ void test_untar_from_memory(void)
test_cat( "/home/test_file", 0, 0 );
/******************/
+ printf( "========= /home/test_script =========\n" );
+ test_cat( "/home/test_script", 0, 0 );
+ test_untar_check_mode("/home/test_script", 0755);
+
+ /******************/
printf( "========= /symlink =========\n" );
test_cat( "/symlink", 0, 0 );
@@ -107,6 +122,11 @@ void test_untar_from_file(void)
test_cat( "/dest/home/test_file", 0, 0 );
/******************/
+ printf( "========= /dest/home/test_script =========\n" );
+ test_cat( "/dest/home/test_script", 0, 0 );
+ test_untar_check_mode("/dest/home/test_script", 0755);
+
+ /******************/
printf( "========= /dest/symlink =========\n" );
test_cat( "/dest/symlink", 0, 0 );
}
@@ -144,6 +164,11 @@ void test_untar_chunks_from_memory(void)
test_cat( "/dest2/home/test_file", 0, 0 );
/******************/
+ printf( "========= /dest2/home/test_script =========\n" );
+ test_cat( "/dest2/home/test_script", 0, 0 );
+ test_untar_check_mode("/dest2/home/test_script", 0755);
+
+ /******************/
printf( "========= /dest2/symlink =========\n" );
test_cat( "/dest2/symlink", 0, 0 );
@@ -184,6 +209,11 @@ void test_untar_unzip_tgz(void)
test_cat( "/dest3/home/test_file", 0, 0 );
/******************/
+ printf( "========= /dest3/home/test_script =========\n" );
+ test_cat( "/dest3/home/test_script", 0, 0 );
+ test_untar_check_mode("/dest3/home/test_script", 0755);
+
+ /******************/
printf( "========= /dest3/symlink =========\n" );
test_cat( "/dest3/symlink", 0, 0 );
}