Mercurial > ecos
changeset 2723:ceb6ac6f0ec1
Update tests to work in configurations without main()
line wrap: on
line diff
--- a/packages/language/c/libc/stdlib/current/ChangeLog +++ b/packages/language/c/libc/stdlib/current/ChangeLog @@ -1,3 +1,22 @@ +2009-01-26 Jonathan Larmour <jifl@eCosCentric.com> + + * tests/abs.c: Allow to run if CYGPKG_LIBC_STARTUP isn't there. + * tests/atoi.c: Ditto. + * tests/atol.c: Ditto. + * tests/bsearch.c: Ditto. + * tests/div.c: Ditto. + * tests/getenv.c: Ditto. + * tests/labs.c: Ditto. + * tests/ldiv.c: Ditto. + * tests/qsort.c: Ditto. + * tests/rand1.c: Ditto. + * tests/rand2.c: Ditto. + * tests/rand3.c: Ditto. + * tests/rand4.c: Ditto. + * tests/srand.c: Ditto. + * tests/strtol.c: Ditto. + * tests/strtoul.c: Ditto. + 2008-12-23 Andrew Lunn <andrew.lunn@ascom.ch> * src/strtoull.cxx, src/strtoll.cxx, src/strtoul.cxx, src/strtoul.cxx:
--- a/packages/language/c/libc/stdlib/current/tests/abs.c +++ b/packages/language/c/libc/stdlib/current/tests/abs.c @@ -49,15 +49,19 @@ //####DESCRIPTIONEND#### // INCLUDES - +#include <pkgconf/system.h> #include <stdlib.h> #include <limits.h> #include <cyg/infra/testcase.h> // FUNCTIONS +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { int x;
--- a/packages/language/c/libc/stdlib/current/tests/atoi.c +++ b/packages/language/c/libc/stdlib/current/tests/atoi.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -94,8 +95,12 @@ test( CYG_ADDRWORD data ) } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/atol.c +++ b/packages/language/c/libc/stdlib/current/tests/atol.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -92,8 +93,12 @@ test( CYG_ADDRWORD data ) "atol() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/bsearch.c +++ b/packages/language/c/libc/stdlib/current/tests/bsearch.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -67,8 +68,12 @@ Compar( const void *int1, const void *in return 1; } // Compar() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { int key; int *result;
--- a/packages/language/c/libc/stdlib/current/tests/div.c +++ b/packages/language/c/libc/stdlib/current/tests/div.c @@ -50,13 +50,18 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> // FUNCTIONS +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { int num, denom; div_t result;
--- a/packages/language/c/libc/stdlib/current/tests/getenv.c +++ b/packages/language/c/libc/stdlib/current/tests/getenv.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> // Main header for stdlib functions #include <cyg/infra/testcase.h> // Testcase API @@ -71,8 +72,12 @@ my_strcmp(const char *s1, const char *s2 return (*s1 - *s2); } // my_strcmp() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { char *str;
--- a/packages/language/c/libc/stdlib/current/tests/labs.c +++ b/packages/language/c/libc/stdlib/current/tests/labs.c @@ -50,13 +50,18 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> // FUNCTIONS +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { int x;
--- a/packages/language/c/libc/stdlib/current/tests/ldiv.c +++ b/packages/language/c/libc/stdlib/current/tests/ldiv.c @@ -50,14 +50,19 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> // FUNCTIONS +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { long num, denom; ldiv_t result;
--- a/packages/language/c/libc/stdlib/current/tests/qsort.c +++ b/packages/language/c/libc/stdlib/current/tests/qsort.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -68,8 +69,12 @@ Compar( const void *int1, const void *in return 1; } // Compar() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int main( int argc, char *argv[] ) +#endif { unsigned int ctr; int fail=0;
--- a/packages/language/c/libc/stdlib/current/tests/rand1.c +++ b/packages/language/c/libc/stdlib/current/tests/rand1.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -84,8 +85,12 @@ test( CYG_ADDRWORD data ) "C library rand() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/rand2.c +++ b/packages/language/c/libc/stdlib/current/tests/rand2.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <pkgconf/libc_stdlib.h> // CYGNUM_LIBC_RAND_SEED #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -90,8 +91,12 @@ test( CYG_ADDRWORD data ) "library rand() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/rand3.c +++ b/packages/language/c/libc/stdlib/current/tests/rand3.c @@ -52,6 +52,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -83,8 +84,12 @@ my_abs(int i) return (i < 0) ? -i : i; } // my_abs() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { // divide the space from 0..RAND_MAX into NUM_BUCKETS categories *BUT* // RAND_MAX / NUM_BUCKETS may not divide exactly so we leave space for
--- a/packages/language/c/libc/stdlib/current/tests/rand4.c +++ b/packages/language/c/libc/stdlib/current/tests/rand4.c @@ -52,6 +52,7 @@ // CONFIGURATION +#include <pkgconf/system.h> #include <pkgconf/libc_stdlib.h> // Configuration header // INCLUDES @@ -69,8 +70,12 @@ // FUNCTIONS +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { #if TEST_VALID int i;
--- a/packages/language/c/libc/stdlib/current/tests/srand.c +++ b/packages/language/c/libc/stdlib/current/tests/srand.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <cyg/infra/testcase.h> @@ -112,8 +113,12 @@ test( CYG_ADDRWORD data ) "C library srand() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/strtol.c +++ b/packages/language/c/libc/stdlib/current/tests/strtol.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <errno.h> #include <limits.h> @@ -166,8 +167,12 @@ test( CYG_ADDRWORD data ) "strtol() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
--- a/packages/language/c/libc/stdlib/current/tests/strtoul.c +++ b/packages/language/c/libc/stdlib/current/tests/strtoul.c @@ -50,6 +50,7 @@ // INCLUDES +#include <pkgconf/system.h> #include <stdlib.h> #include <errno.h> #include <limits.h> @@ -162,8 +163,12 @@ test( CYG_ADDRWORD data ) "strtoul() function"); } // test() +#ifndef CYGPKG_LIBC_STARTUP +void cyg_user_start(void) +#else int -main(int argc, char *argv[]) +main( int argc, char *argv[] ) +#endif { CYG_TEST_INIT();
