changeset 2725:fa083e5b947e

Make the string tests work in configurations which do not involve main().
author bartv
date Wed, 28 Jan 2009 15:28:56 +0000
parents 9ab1839abc2c
children 15a9d2b134ef
files packages/language/c/libc/string/current/ChangeLog packages/language/c/libc/string/current/tests/memchr.c packages/language/c/libc/string/current/tests/memcmp1.c packages/language/c/libc/string/current/tests/memcmp2.c packages/language/c/libc/string/current/tests/memcpy1.c packages/language/c/libc/string/current/tests/memcpy2.c packages/language/c/libc/string/current/tests/memmove1.c packages/language/c/libc/string/current/tests/memmove2.c packages/language/c/libc/string/current/tests/memset.c packages/language/c/libc/string/current/tests/strcat1.c packages/language/c/libc/string/current/tests/strcat2.c packages/language/c/libc/string/current/tests/strchr.c packages/language/c/libc/string/current/tests/strcmp1.c packages/language/c/libc/string/current/tests/strcmp2.c packages/language/c/libc/string/current/tests/strcoll1.c packages/language/c/libc/string/current/tests/strcoll2.c packages/language/c/libc/string/current/tests/strcpy1.c packages/language/c/libc/string/current/tests/strcpy2.c packages/language/c/libc/string/current/tests/strcspn.c packages/language/c/libc/string/current/tests/strlen.c packages/language/c/libc/string/current/tests/strncat1.c packages/language/c/libc/string/current/tests/strncat2.c packages/language/c/libc/string/current/tests/strncpy1.c packages/language/c/libc/string/current/tests/strncpy2.c packages/language/c/libc/string/current/tests/strpbrk.c packages/language/c/libc/string/current/tests/strrchr.c packages/language/c/libc/string/current/tests/strspn.c packages/language/c/libc/string/current/tests/strstr.c packages/language/c/libc/string/current/tests/strtok.c packages/language/c/libc/string/current/tests/strxfrm1.c packages/language/c/libc/string/current/tests/strxfrm2.c
diffstat 31 files changed, 186 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/language/c/libc/string/current/ChangeLog
+++ b/packages/language/c/libc/string/current/ChangeLog
@@ -1,3 +1,37 @@
+2009-01-26  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/memchr.c (main): Rename to cyg_user_start if main isn't
+	going to be called.
+	* tests/memcmp1.c (main): Ditto.
+	* tests/memcmp2.c (main): Ditto.
+	* tests/memcpy1.c (main): Ditto.
+	* tests/memcpy2.c (main): Ditto.
+	* tests/memmove1.c (main): Ditto.
+	* tests/memmove2.c (main): Ditto.
+	* tests/memset.c (main): Ditto.
+        * tests/strcat1.c (main): Ditto.
+        * tests/strcat2.c (main): Ditto.
+        * tests/strchr.c (main): Ditto.
+        * tests/strcmp1.c (main): Ditto.
+        * tests/strcmp2.c (main): Ditto.
+        * tests/strcoll1.c (main): Ditto.
+        * tests/strcoll2.c (main): Ditto.
+        * tests/strcpy1.c (main): Ditto.
+        * tests/strcpy2.c (main): Ditto.
+        * tests/strcspn.c (main): Ditto.
+        * tests/strlen.c (main): Ditto.
+        * tests/strncat1.c (main): Ditto.
+        * tests/strncat2.c (main): Ditto.
+        * tests/strncpy1.c (main): Ditto.
+        * tests/strncpy2.c (main): Ditto.
+        * tests/strpbrk.c (main): Ditto.
+        * tests/strrchr.c (main): Ditto.
+        * tests/strspn.c (main): Ditto.
+        * tests/strstr.c (main): Ditto.
+        * tests/strtok.c (main): Ditto.
+        * tests/strxfrm1.c (main): Ditto.
+        * tests/strxfrm2.c (main): Ditto.
+
 2005-07-22  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/strcmp.cxx (__strcmp): Set retval to zero to avoid compiler
--- a/packages/language/c/libc/string/current/tests/memchr.c
+++ b/packages/language/c/libc/string/current/tests/memchr.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -68,7 +69,11 @@ static int my_strcmp(const char *s1, con
     return (*s1 - *s2);
 } // my_strcmp()
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[] = "Your feeble skills are no match for the power of "
                "the dark side!";
--- a/packages/language/c/libc/string/current/tests/memcmp1.c
+++ b/packages/language/c/libc/string/current/tests/memcmp1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -80,7 +81,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memcmp2.c
+++ b/packages/language/c/libc/string/current/tests/memcmp2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -84,7 +85,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memcpy1.c
+++ b/packages/language/c/libc/string/current/tests/memcpy1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -92,7 +93,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memcpy2.c
+++ b/packages/language/c/libc/string/current/tests/memcpy2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -96,7 +97,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memmove1.c
+++ b/packages/language/c/libc/string/current/tests/memmove1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -91,7 +92,11 @@ static char *my_strcpy(char *s1, const c
     return s1; 
 } // my_strcpy()
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memmove2.c
+++ b/packages/language/c/libc/string/current/tests/memmove2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -96,7 +97,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/memset.c
+++ b/packages/language/c/libc/string/current/tests/memset.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -81,7 +82,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char *ret;
--- a/packages/language/c/libc/string/current/tests/strcat1.c
+++ b/packages/language/c/libc/string/current/tests/strcat1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -81,7 +82,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcat2.c
+++ b/packages/language/c/libc/string/current/tests/strcat2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -84,7 +85,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strchr.c
+++ b/packages/language/c/libc/string/current/tests/strchr.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -70,7 +71,11 @@ static int my_strcmp(const char *s1, con
 } // my_strcmp()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[] = "Your feeble skills are no match for the power of "
                "the dark side!";
--- a/packages/language/c/libc/string/current/tests/strcmp1.c
+++ b/packages/language/c/libc/string/current/tests/strcmp1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -68,7 +69,11 @@ static char *my_strcpy(char *s1, const c
     return s1; 
 } // my_strcpy()
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcmp2.c
+++ b/packages/language/c/libc/string/current/tests/strcmp2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -72,7 +73,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcoll1.c
+++ b/packages/language/c/libc/string/current/tests/strcoll1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -70,7 +71,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcoll2.c
+++ b/packages/language/c/libc/string/current/tests/strcoll2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -72,7 +73,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcpy1.c
+++ b/packages/language/c/libc/string/current/tests/strcpy1.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -81,7 +82,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcpy2.c
+++ b/packages/language/c/libc/string/current/tests/strcpy2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -85,7 +86,11 @@ static int my_strcmp(const char *s1, con
 } // my_strcmp()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strcspn.c
+++ b/packages/language/c/libc/string/current/tests/strcspn.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -81,7 +82,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strlen.c
+++ b/packages/language/c/libc/string/current/tests/strlen.c
@@ -50,13 +50,18 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
 
 // FUNCTIONS
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[]="";
     char y[]="The force is strong in this one";
--- a/packages/language/c/libc/string/current/tests/strncat1.c
+++ b/packages/language/c/libc/string/current/tests/strncat1.c
@@ -55,6 +55,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -98,7 +99,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strncat2.c
+++ b/packages/language/c/libc/string/current/tests/strncat2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -97,7 +98,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strncpy1.c
+++ b/packages/language/c/libc/string/current/tests/strncpy1.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2006 eCosCentric Limited
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -50,6 +51,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -110,8 +112,12 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int
 main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strncpy2.c
+++ b/packages/language/c/libc/string/current/tests/strncpy2.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -96,7 +97,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strpbrk.c
+++ b/packages/language/c/libc/string/current/tests/strpbrk.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -69,7 +70,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strrchr.c
+++ b/packages/language/c/libc/string/current/tests/strrchr.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -69,7 +70,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char *ret;
--- a/packages/language/c/libc/string/current/tests/strspn.c
+++ b/packages/language/c/libc/string/current/tests/strspn.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -70,7 +71,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strstr.c
+++ b/packages/language/c/libc/string/current/tests/strstr.c
@@ -50,6 +50,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -69,7 +70,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strtok.c
+++ b/packages/language/c/libc/string/current/tests/strtok.c
@@ -55,6 +55,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -146,8 +147,11 @@ test( CYG_ADDRWORD data )
 
 } // test()
 
-int
-main(int argc, char *argv[])
+#if CYGINT_ISO_MAIN_STARTUP
+int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     CYG_TEST_INIT();
 
--- a/packages/language/c/libc/string/current/tests/strxfrm1.c
+++ b/packages/language/c/libc/string/current/tests/strxfrm1.c
@@ -55,6 +55,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -98,7 +99,11 @@ static char *my_strcpy(char *s1, const c
 } // my_strcpy()
 
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];
--- a/packages/language/c/libc/string/current/tests/strxfrm2.c
+++ b/packages/language/c/libc/string/current/tests/strxfrm2.c
@@ -55,6 +55,7 @@
 
 // INCLUDES
 
+#include <pkgconf/isoinfra.h>
 #include <string.h>
 #include <cyg/infra/testcase.h>
 
@@ -101,7 +102,11 @@ static char *my_strcpy(char *s1, const c
     return s1; 
 } // my_strcpy()
 
+#if CYGINT_ISO_MAIN_STARTUP
 int main( int argc, char *argv[] )
+#else
+void cyg_user_start(void)
+#endif
 {
     char x[300];
     char y[300];