<div dir="ltr"><div>ping !!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 4, 2021 at 3:04 AM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com">eshandhawan51@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Eshan dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank">eshandhawan51@gmail.com</a>><br>
<br>
Signed-off-by: Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank">eshandhawan51@gmail.com</a>><br>
---<br>
spec/build/testsuites/psxtests/grp.yml | 2 +<br>
spec/build/testsuites/psxtests/psxftw01.yml | 34 ++++<br>
testsuites/psxtests/Makefile.am | 26 +++<br>
testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 1 +<br>
testsuites/psxtests/psxftw01/init.c | 204 ++++++++++++++++++++<br>
testsuites/psxtests/psxftw01/psxftw01.doc | 18 ++<br>
testsuites/psxtests/psxftw01/psxftw01.scn | 10 +<br>
testsuites/psxtests/psxftw01/psxftw01.tar | Bin 0 -> 3584 bytes<br>
8 files changed, 295 insertions(+)<br>
create mode 100644 spec/build/testsuites/psxtests/psxftw01.yml<br>
create mode 100644 testsuites/psxtests/psxftw01/init.c<br>
create mode 100644 testsuites/psxtests/psxftw01/psxftw01.doc<br>
create mode 100644 testsuites/psxtests/psxftw01/psxftw01.scn<br>
create mode 100644 testsuites/psxtests/psxftw01/psxftw01.tar<br>
<br>
diff --git a/spec/build/testsuites/psxtests/grp.yml b/spec/build/testsuites/psxtests/grp.yml<br>
index 47dedac275..fb7ce465ae 100644<br>
--- a/spec/build/testsuites/psxtests/grp.yml<br>
+++ b/spec/build/testsuites/psxtests/grp.yml<br>
@@ -109,6 +109,8 @@ links:<br>
uid: psxfile02<br>
- role: build-dependency<br>
uid: psxfilelock01<br>
+- role: build-dependency<br>
+ uid: psxftw01<br>
- role: build-dependency<br>
uid: psxgetattrnp01<br>
- role: build-dependency<br>
diff --git a/spec/build/testsuites/psxtests/psxftw01.yml b/spec/build/testsuites/psxtests/psxftw01.yml<br>
new file mode 100644<br>
index 0000000000..c8b2a4fb59<br>
--- /dev/null<br>
+++ b/spec/build/testsuites/psxtests/psxftw01.yml<br>
@@ -0,0 +1,34 @@<br>
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
+build-type: script<br>
+cflags: []<br>
+copyrights:<br>
+- Copyright (C) 2020 Eshan Dhawan<br>
+cppflags: []<br>
+do-build: |<br>
+ path = "testsuites/psxtests/psxftw01/"<br>
+ tar = path + "psxftw01.tar"<br>
+ tar_gz = self.gzip(bld, tar)<br>
+ tar_xz = self.xz(bld, tar)<br>
+ tar_c, tar_h = self.bin2c(bld, tar)<br>
+ tar_gz_c, tar_gz_h = self.bin2c(bld, tar_gz)<br>
+ tar_xz_c, tar_xz_h = self.bin2c(bld, tar_xz)<br>
+ objs = []<br>
+ objs.append(self.cc(bld, bic, tar_c))<br>
+ objs.append(self.cc(bld, bic, tar_gz_c))<br>
+ objs.append(self.cc(bld, bic, tar_xz_c))<br>
+ objs.append(self.cc(bld, bic, path + "init.c", deps=[tar_h, tar_gz_h, tar_xz_h], cppflags=bld.env.TEST_psxftw01_CPPFLAGS))<br>
+ objs.append(self.cc(bld, bic, "testsuites/psxtests/psxfile01/test_cat.c", target=path + "test_cat.o"))<br>
+ self.link_cc(bld, bic, objs, "testsuites/psxtests/psxftw01.exe")<br>
+do-configure: null<br>
+enabled-by: true<br>
+includes:<br>
+- testsuites/psxtests/psxftw01<br>
+ldflags: []<br>
+links: []<br>
+prepare-build: null<br>
+prepare-configure: null<br>
+stlib: []<br>
+type: build<br>
+use-after:<br>
+- z<br>
+use-before: []<br>
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am<br>
index d89bcd8801..a35f00b665 100755<br>
--- a/testsuites/psxtests/Makefile.am<br>
+++ b/testsuites/psxtests/Makefile.am<br>
@@ -453,6 +453,32 @@ psxfilelock01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxfilelock01) \<br>
$(support_includes)<br>
endif<br>
<br>
+if TEST_psxftw01<br>
+psx_tests += psxftw01<br>
+psx_screens += psxftw01/psxftw01.scn<br>
+psx_docs += psxftw01/psxftw01.doc<br>
+psxftw01_SOURCES = psxftw01/init.c psxfile01/test_cat.c \<br>
+ psxftw01-tar.c psxftw01-tar.h psxftw01-tar-gz.c psxftw01-tar-gz.h<br>
+<br>
+psxftw01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxftw01) \<br>
+ $(support_includes) $(test_includes) -I$(top_srcdir)/include<br>
+psxftw01_LDADD = $(RTEMS_ROOT)cpukit/librtemscpu.a $(RTEMS_ROOT)cpukit/libz.a $(LDADD)<br>
+psxftw01-tar.c: psxftw01/psxftw01.tar<br>
+ $(AM_V_GEN)$(BIN2C) -C $< $@<br>
+psxftw01-tar.h: psxftw01/psxftw01.tar<br>
+ $(AM_V_GEN)$(BIN2C) -H $< $@<br>
+psxftw01-tar.o: psxftw01-tar.c psxftw01-tar.h<br>
+psxftw01.tar.gz: psxftw01/psxftw01.tar<br>
+ $(AM_V_GEN)$(GZIP) < $< > $@<br>
+psxftw01-tar-gz.c: psxftw01.tar.gz<br>
+ $(AM_V_GEN)$(BIN2C) -C $< $@<br>
+psxftw01-tar-gz.h: psxftw01.tar.gz<br>
+ $(AM_V_GEN)$(BIN2C) -H $< $@<br>
+CLEANFILES += psxftw01.tar psxftw01-tar.c psxftw01-tar.h \<br>
+ psxftw01.tar.gz psxftw01-tar-gz.c psxftw01-tar-gz.h<br>
+psxftw01/init.c: psxftw01-tar.h psxftw01-tar-gz.h $(TAR01_XZ_H)<br>
+endif<br>
+<br>
if TEST_psxgetattrnp01<br>
psx_tests += psxgetattrnp01<br>
psx_screens += psxgetattrnp01/psxgetattrnp01.scn<br>
diff --git a/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 139787cccb..3f95010cd3 100644<br>
--- a/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -90,6 +90,7 @@ RTEMS_TEST_CHECK([psxfenv01])<br>
RTEMS_TEST_CHECK([psxfile01])<br>
RTEMS_TEST_CHECK([psxfile02])<br>
RTEMS_TEST_CHECK([psxfilelock01])<br>
+RTEMS_TEST_CHECK([psxftw01])<br>
RTEMS_TEST_CHECK([psxgetattrnp01])<br>
RTEMS_TEST_CHECK([psxgetrusage01])<br>
RTEMS_TEST_CHECK([psxglobalcon01])<br>
diff --git a/testsuites/psxtests/psxftw01/init.c b/testsuites/psxtests/psxftw01/init.c<br>
new file mode 100644<br>
index 0000000000..bc3858395f<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxftw01/init.c<br>
@@ -0,0 +1,204 @@<br>
+/*<br>
+ * @file<br>
+ * @brief Test suite for ftw.h methods<br>
+ */<br>
+<br>
+/*<br>
+ * SPDX-License-Identifier: BSD-2-Clause<br>
+ *<br>
+ * Copyright (C) 2020 Eshan Dhawan, embedded brains GmbH, Joel Sherrill<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ * notice, this list of conditions and the following disclaimer.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br>
+ * notice, this list of conditions and the following disclaimer in the<br>
+ * documentation and/or other materials provided with the distribution.<br>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
+ * POSSIBILITY OF SUCH DAMAGE.<br>
+ */<br>
+<br>
+#ifdef HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+/* Header files */<br>
+#include <bsp.h> /* for device driver prototypes */<br>
+#include "tmacros.h"<br>
+#include <rtems.h><br>
+#include <rtems/bspIo.h><br>
+#include <rtems/untar.h><br>
+#include <rtems/error.h><br>
+#include <ftw.h><br>
+#include <dirent.h><br>
+#include <sys/stat.h><br>
+#include <errno.h><br>
+#include <unistd.h><br>
+#include <string.h><br>
+#include <stdio.h><br>
+#include <stdlib.h><br>
+#include <rtems/test.h><br>
+<br>
+#include "psxftw01-tar.h"<br>
+#include "psxftw01-tar-gz.h"<br>
+<br>
+#define TARFILE_START psxftw01_tar<br>
+#define TARFILE_SIZE psxftw01_tar_size<br>
+#define TARFILE_GZ_START psxftw01_tar_gz<br>
+#define TARFILE_GZ_SIZE psxftw01_tar_gz_size<br>
+<br>
+const char rtems_test_name[] = "psxftw01";<br>
+/* Function decleration to avoid warning */<br>
+void *POSIX_Init (void * argument);<br>
+<br>
+static char file_traverse_order[6][20];<br>
+static int file_order;<br>
+<br>
+static char buffer[512];<br>
+<br>
+static const T_action actions[] = {<br>
+ T_report_hash_sha256,<br>
+ T_check_task_context,<br>
+ T_check_file_descriptors,<br>
+ T_check_rtems_barriers,<br>
+ T_check_rtems_extensions,<br>
+ T_check_rtems_message_queues,<br>
+ T_check_rtems_partitions,<br>
+ T_check_rtems_periods,<br>
+ T_check_rtems_regions,<br>
+ T_check_rtems_semaphores,<br>
+ T_check_rtems_tasks,<br>
+ T_check_rtems_timers,<br>
+ T_check_posix_keys<br>
+};<br>
+<br>
+static const T_config config = {<br>
+ .name = "psxftw01",<br>
+ .buf = buffer,<br>
+ .buf_size = sizeof(buffer),<br>
+ .putchar = rtems_put_char,<br>
+ .verbosity = T_VERBOSE,<br>
+ .now = T_now_clock,<br>
+ .action_count = T_ARRAY_SIZE(actions),<br>
+ .actions = actions<br>
+};<br>
+<br>
+<br>
+static int fn_function (const char *fpath, const struct stat *sb,<br>
+int tflag, struct FTW *ftwbuf)<br>
+{ <br>
+ strcpy(file_traverse_order [file_order], fpath + ftwbuf->base) ;<br>
+ file_order = file_order + 1; <br>
+ return 0; /* to make nftw run further */<br>
+}<br>
+<br>
+<br>
+T_TEST_CASE(ftw)<br>
+{<br>
+ <br>
+ /* VARIABLE DECLEARATION */ <br>
+ int r;<br>
+ char *files_path;<br>
+ int flags;<br>
+ int i;<br>
+ /* setting up filesystem */<br>
+ rtems_status_code sc;<br>
+<br>
+ /*Untaring from memory */<br>
+ sc = Untar_FromMemory_Print(<br>
+ (void *)TARFILE_START,<br>
+ TARFILE_SIZE,<br>
+ &rtems_test_printer<br>
+ );<br>
+ if (sc != RTEMS_SUCCESSFUL) {<br>
+ printf ("error: untar failed: %s\n", rtems_status_text (sc));<br>
+ }<br>
+ <br>
+ /* Array with expected file order */<br>
+ char arr_ftw_depth[5][20] = { "test_file", "test_script", "def", "abc", "home" };<br>
+ char arr_ftw_phys[5][20] = { "home", "test_file", "abc", "def", "test_script" };<br>
+ /* defining the path to run nftw*/ <br>
+ files_path = "/home";<br>
+ /* nftw test with FTW_DEPTH flag*/ <br>
+ flags = 0;<br>
+ file_order = 0;<br>
+ flags |= FTW_DEPTH;<br>
+ r = nftw( files_path, fn_function, 5, flags );<br>
+<br>
+ T_quiet_psx_success(r);<br>
+<br>
+ /*comparing the nftw file tree to the expexted file tree traversal */<br>
+ for (i = 0; i < file_order; i++){<br>
+ r = strcmp( arr_ftw_depth[i], file_traverse_order[i]);<br>
+ if (r){<br>
+ printf( "Incorrect Order " );<br>
+ }<br>
+ T_quiet_psx_success(r);<br>
+ }<br>
+ /*----------------Test Block 2--------------------*/<br>
+ flags = 0;<br>
+ file_order = 0;<br>
+ flags |= FTW_PHYS;<br>
+ r = nftw( files_path, fn_function, 5, flags );<br>
+ T_quiet_psx_success(r);<br>
+<br>
+ /*comparing the nftw file tree to the expected file tree traversal*/<br>
+ for (i = 0; i < file_order; i++){<br>
+ r = strcmp( arr_ftw_phys[i], file_traverse_order[i]);<br>
+ if (r){<br>
+ printf( "Incorrect Order " );<br>
+ }<br>
+ T_quiet_psx_success(r);<br>
+ }<br>
+<br>
+}<br>
+<br>
+void *POSIX_Init (void * argument)<br>
+{<br>
+ int exit_code;<br>
+<br>
+ TEST_BEGIN();<br>
+<br>
+ T_register();<br>
+ exit_code = T_main(&config);<br>
+ if (exit_code == 0) {<br>
+ TEST_END();<br>
+ }<br>
+<br>
+ rtems_test_exit(exit_code);<br>
+<br>
+}<br>
+<br>
+/* NOTICE: the clock driver is explicitly disabled */<br>
+<br>
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER<br>
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
+<br>
+#define CONFIGURE_MAXIMUM_TASKS 1<br>
+<br>
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 6<br>
+<br>
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 2 <br>
+<br>
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION<br>
+<br>
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br>
+<br>
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT<br>
+<br>
+<br>
+#define CONFIGURE_INIT<br>
+#include <rtems/confdefs.h><br>
+/* end of file */<br>
diff --git a/testsuites/psxtests/psxftw01/psxftw01.doc b/testsuites/psxtests/psxftw01/psxftw01.doc<br>
new file mode 100644<br>
index 0000000000..7b2863a2da<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxftw01/psxftw01.doc<br>
@@ -0,0 +1,18 @@<br>
+# COPYRIGHT (c) 2019<br>
+# On-Line Applications Research Corporation (OAR).<br>
+#<br>
+# SPDX-License-Identifier: BSD-2-Clause<br>
+#<br>
+<br>
+This file describes the directives and concepts tested by this test set.<br>
+<br>
+test set name: psxftw01<br>
+<br>
+Directives:<br>
+nftw <br>
+<br>
+Concepts:<br>
+<br>
++ This test exercises the ftw.h methods.<br>
+<br>
+<br>
diff --git a/testsuites/psxtests/psxftw01/psxftw01.scn b/testsuites/psxtests/psxftw01/psxftw01.scn<br>
new file mode 100644<br>
index 0000000000..650d365033<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxftw01/psxftw01.scn<br>
@@ -0,0 +1,10 @@<br>
+*** BEGIN OF TEST psxftw01 ***<br>
+<br>
+untar: memory at 0x12608c (10240)<br>
+untar: file: home/test_file (s:73,m:0644)<br>
+untar: file: home/abc/def/test_script (s:21,m:0755)<br>
+untar: symlink: home/test_file -> symlink<br>
+<br>
+*** END OF TEST psxftw01 ***<br>
+<br>
+<br>
diff --git a/testsuites/psxtests/psxftw01/psxftw01.tar b/testsuites/psxtests/psxftw01/psxftw01.tar<br>
new file mode 100644<br>
index 0000000000000000000000000000000000000000..e45d10793a9fbcadc7d1ee84d42d13ff8eb2655e<br>
GIT binary patch<br>
literal 3584<br>
zcmeHJ!EVAZ4DFe(@U-)WlQ!uW?6}Lu9R)~fM4C=@nZ)1Eq3gsD8sbnuTCGY}>(?ZH<br>
z$+J_|m7TVh+Iiu;O$ISU)L8}z$~2RB;5iUY2mvD1LQAC(Q$V4$zyxrR)f^4FrPeeF<br>
zBH4wZ)|oIbj}YDKs;-O+uqE5jDL|JBC$~2^1-Zv>v(gdpV;~*^s0;A5S-G$V6X0$3<br>
z^7;<(V9<_QTS3v(6$d6RIHt-2QwOdxYx_L8$K=K}on@em`ZtT^bY+XK4$!i3AMM#6<br>
zF95J2a;2g)M6RO#e|#qvlo~|FMM7yQ8Nm8amAtb4L+xGhM*%z+?{(k%3;4Mu^zi{K<br>
zl`Lsb@Z=2vAB4|Q%(vW<tIkck%Db=`bk3;%JU{6B{XO7Y{_KADe~DZN5|I1iH1Or*<br>
TpZEVkH+~#^WME|At{M0OLN<HT<br>
<br>
literal 0<br>
HcmV?d00001<br>
<br>
-- <br>
2.27.0<br>
<br>
</blockquote></div>