Hi guys,

Here is the patch file for strings.h

Thanks
Himanshu
From 9ef5ec8e6964e3b18239a3579f998840828094ce Mon Sep 17 00:00:00 2001
From: Himanshu40 <himanshuwindows...@gmail.com>
Date: Sat, 1 Dec 2018 22:22:42 +0530
Subject: [PATCH] psxtests: add POSIX API signature tests for strings.h file
 (GCI 2018)

---
 testsuites/psxtests/Makefile.am               | 11 ++++-
 testsuites/psxtests/psxhdrs/strings/bcmp.c    | 36 ++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/bcopy.c   | 40 ++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/ffs.c     | 39 ++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/index.c   | 41 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/strings/rindex.c  | 41 +++++++++++++++++++
 .../psxtests/psxhdrs/strings/strcasecmp.c     | 38 +++++++++++++++++
 .../psxtests/psxhdrs/strings/strcasecmp_l.c   | 39 ++++++++++++++++++
 .../psxtests/psxhdrs/strings/strncasecmp.c    | 38 +++++++++++++++++
 .../psxtests/psxhdrs/strings/strncasecmp_l.c  | 39 ++++++++++++++++++
 10 files changed, 361 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/psxtests/psxhdrs/strings/bcmp.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/bcopy.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/ffs.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/index.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/rindex.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/strcasecmp.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/strncasecmp.c
 create mode 100644 testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 14e78e09a7..03e823e7db 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1113,7 +1113,16 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/semaphore/sem_post.c \
 	psxhdrs/semaphore/sem_wait.c \
 	psxhdrs/semaphore/sem_trywait.c \
-	psxhdrs/semaphore/sem_timedwait.c 
+	psxhdrs/semaphore/sem_timedwait.c \
+	psxhdrs/strings/bcmp.c \
+	psxhdrs/strings/bcopy.c \
+	psxhdrs/strings/ffs.c \
+	psxhdrs/strings/index.c \
+	psxhdrs/strings/rindex.c \
+	psxhdrs/strings/strcasecmp.c \
+	psxhdrs/strings/strcasecmp_l.c \
+	psxhdrs/strings/strncasecmp.c \
+	psxhdrs/strings/strncasecmp_l.c
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/strings/bcmp.c b/testsuites/psxtests/psxhdrs/strings/bcmp.c
new file mode 100644
index 0000000000..0e95a694f9
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/bcmp.c
@@ -0,0 +1,36 @@
+/**
+ *  @file
+ *  @brief bcmp() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   int result;
+
+   result = bcmp( "Hello there", "Hello world", 6 );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/bcopy.c b/testsuites/psxtests/psxhdrs/strings/bcopy.c
new file mode 100644
index 0000000000..0a54f5a801
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/bcopy.c
@@ -0,0 +1,40 @@
+/**
+ *  @file
+ *  @brief bcopy() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   auto char buffer[50];
+
+   bcopy( "Hello ", buffer, 6 );
+   bcopy( "world", &buffer[6], 6 );
+   result = 0;
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/ffs.c b/testsuites/psxtests/psxhdrs/strings/ffs.c
new file mode 100644
index 0000000000..e4b212d9f5
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/ffs.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief ffs() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   int i;
+   int result;
+
+   i = 64;
+
+   result = ffs( i );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/index.c b/testsuites/psxtests/psxhdrs/strings/index.c
new file mode 100644
index 0000000000..b4dbc32aaf
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/index.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief index() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   char *p;
+   char *string = "This is a string for testing";
+
+   p = index( string, 'i' );
+   (void) p;
+   result = 0;
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/rindex.c b/testsuites/psxtests/psxhdrs/strings/rindex.c
new file mode 100644
index 0000000000..220a6553d4
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/rindex.c
@@ -0,0 +1,41 @@
+/**
+ *  @file
+ *  @brief rindex() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int result = 1;
+
+ int test( void )
+ {
+   char *p;
+   char *string = "This is a string for testing";
+
+   p = rindex( string, 'i' );
+   (void) p;
+   result = 0;
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strcasecmp.c b/testsuites/psxtests/psxhdrs/strings/strcasecmp.c
new file mode 100644
index 0000000000..3ed4b511e7
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strcasecmp.c
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief strcasecmp() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   char *string1 = "STRING";
+   char *string2 = "string";
+   int result;
+
+   result = strcasecmp( string1, string2 );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
new file mode 100644
index 0000000000..cdcdff7de2
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief strcasecmp_l() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+ #include <locale.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   char *string1 = "STRING";
+   char *string2 = "string";
+   int result;
+
+   result = strcasecmp_l( string1, string2, LC_CTYPE );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strncasecmp.c b/testsuites/psxtests/psxhdrs/strings/strncasecmp.c
new file mode 100644
index 0000000000..26899f73a7
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strncasecmp.c
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief strncasecmp() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   char *string1 = "STRING ONE";
+   char *string2 = "string TWO";
+   int result;
+
+   result = strncasecmp( string1, string2, 6 );
+
+   return result;
+ }
diff --git a/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c b/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c
new file mode 100644
index 0000000000..9b0792fda5
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/strings/strncasecmp_l.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief strcasecmp_l() API Conformance Test
+ */
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
+ #include <strings.h>
+ #include <locale.h>
+
+ int test( void );
+
+ int test( void )
+ {
+   char *string1 = "STRING";
+   char *string2 = "string";
+   int result;
+
+   result = strncasecmp_l( string1, string2, 6, LC_CTYPE );
+
+   return result;
+ }
-- 
2.17.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to