On Mon, Jun 3, 2019 at 8:37 AM Aditya Upadhyay <aadit0...@gmail.com> wrote: > > On Sat, Jun 1, 2019 at 10:22 PM Gedare Bloom <ged...@rtems.org> wrote: > > > > > > > > On Sat, Jun 1, 2019, 8:29 AM Aditya Upadhyay <aadit0...@gmail.com> wrote: > >> > >> On Sat, Jun 1, 2019 at 5:03 AM Gedare Bloom <ged...@rtems.org> wrote: > >> > > >> > On Fri, May 31, 2019 at 10:17 AM Aditya Upadhyay <aadit0...@gmail.com> > >> > wrote: > >> > > > >> > > Hi VARoDeK, > >> > > > >> > > This looks fine to me. I would love to see other's responses. > >> > > > >> > > >> > This test is not right, it needs to be rethought. Let me know if you > >> > need further guidance. > >> > > >> Yeah, Gedare !! I need some further guidance. I had written this test > >> 1 year ago, but could not send it on devel. > >> I was writing this testsuite for the very first time. > > > > > > If you wrote the test, your name should belong in the copyright info. > > > I had handed over this code to Vaibhav for sake of learning purposes. > If Community > does not allow this, Then I would take it back. I would appreciate > your thought on that. >
It is perfectly acceptable (and normal) for a student to carry-on with someone else's code, but the original author's contribution (and copyright) need to be maintained. Usually, what we prefer is to have a commit with the original author's code, and then additional commits to change it as needed. > >> Could you please point me an example? > > > > > > Which psxtest was this derived from? Is there a psxtest that considers > > string conversions? That would be a good start. Do some digging. > > > Thanks for pointing it out. Though I am working on a needed > correction. Would It be a wise choice to test cases > for each inttypes methods? > > > The logic of the test needs to be thought out. What is the expected > > behavior being tested? How do you isolate correct/incorrect behavior? > > > I had used hardcoded input only for the success of the operation. I > will also consider the expected behavior for Invalid inputs. > > > Gedare > > > >> Although I have gone through > >> open group POSIX > >> Page and looked into some previously made testsuites in the psxtests > >> directory. > >> > >> While configuring, I had used --enable-tests=yes option, but I do not > >> see any generated .exe file. > >> or Can we generate the .exe file manually? > >> > >> > >> > > On Thu, May 30, 2019 at 8:47 PM VARoDeK <vaibhavgupt...@gmail.com> > >> > > wrote: > >> > > > > >> > > > --- > >> > > > testsuites/psxtests/Makefile.am | 7 + > >> > > > testsuites/psxtests/configure.ac | 1 + > >> > > > testsuites/psxtests/psxinttypes01/init.c | 154 > >> > > > ++++++++++++++++++ > >> > > > .../psxtests/psxinttypes01/psxinttypes01.doc | 57 +++++++ > >> > > > .../psxtests/psxinttypes01/psxinttypes01.scn | 28 ++++ > >> > > > 5 files changed, 247 insertions(+) > >> > > > create mode 100644 testsuites/psxtests/psxinttypes01/init.c > >> > > > create mode 100644 > >> > > > testsuites/psxtests/psxinttypes01/psxinttypes01.doc > >> > > > create mode 100644 > >> > > > testsuites/psxtests/psxinttypes01/psxinttypes01.scn > >> > > > > >> > > > diff --git a/testsuites/psxtests/Makefile.am > >> > > > b/testsuites/psxtests/Makefile.am > >> > > > index 749258cc0c..f619dd9ae9 100644 > >> > > > --- a/testsuites/psxtests/Makefile.am > >> > > > +++ b/testsuites/psxtests/Makefile.am > >> > > > @@ -22,6 +22,13 @@ psx01_CPPFLAGS = $(AM_CPPFLAGS) > >> > > > $(TEST_FLAGS_psx01) \ > >> > > > $(support_includes) -I$(top_srcdir)/include > >> > > > endif > >> > > > > >> > > > +if TEST_psxinttypes01 > >> > > > +psx_tests += psxinttypes01 > >> > > > +psxinttypes01_SOURCES = psxinttypes01/init.c > >> > > > +psxinttypes01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxinttypes01) > >> > > > \ > >> > > > + $(support_includes) > >> > > > +endif > >> > > > + > >> > > > if HAS_POSIX > >> > > > if TEST_psx02 > >> > > > psx_tests += psx02 > >> > > > diff --git a/testsuites/psxtests/configure.ac > >> > > > b/testsuites/psxtests/configure.ac > >> > > > index cdd6ee7e4e..e032a6f5ec 100644 > >> > > > --- a/testsuites/psxtests/configure.ac > >> > > > +++ b/testsuites/psxtests/configure.ac > >> > > > @@ -140,6 +140,7 @@ RTEMS_TEST_CHECK([psxtimes01]) > >> > > > RTEMS_TEST_CHECK([psxualarm]) > >> > > > RTEMS_TEST_CHECK([psxusleep]) > >> > > > RTEMS_TEST_CHECK([lib_a]) > >> > > > +RTEMS_TEST_CHECK([psxinttypes01]) > >> > > > > >> > > > AC_CONFIG_FILES([Makefile]) > >> > > > AC_OUTPUT > >> > > > diff --git a/testsuites/psxtests/psxinttypes01/init.c > >> > > > b/testsuites/psxtests/psxinttypes01/init.c > >> > > > new file mode 100644 > >> > > > index 0000000000..1c6340afe2 > >> > > > --- /dev/null > >> > > > +++ b/testsuites/psxtests/psxinttypes01/init.c > >> > > > @@ -0,0 +1,154 @@ > >> > > > +/** > >> > > > + * @file > >> > > > + * @brief Test suite for inttypes.h methods > >> > > > + */ > >> > > > + > >> > > > +/* > >> > > > + * SPDX-License-Identifier: BSD-2-Clause > >> > > > + * > >> > > > + * Copyright (C) 2019, Vaibhav Gupta > >> > > > + * > >> > > > + * Redistribution and use in source and binary forms, with or > >> > > > without > >> > > > + * modification, are permitted provided that the following > >> > > > conditions > >> > > > + * are met: > >> > > > + * 1. Redistributions of source code must retain the above copyright > >> > > > + * notice, this list of conditions and the following disclaimer. > >> > > > + * 2. Redistributions in binary form must reproduce the above > >> > > > copyright > >> > > > + * notice, this list of conditions and the following disclaimer > >> > > > in the > >> > > > + * documentation and/or other materials provided with the > >> > > > distribution. > >> > > > + * > >> > > > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > >> > > > CONTRIBUTORS "AS IS" > >> > > > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > >> > > > LIMITED TO, THE > >> > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > >> > > > PARTICULAR PURPOSE > >> > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR > >> > > > CONTRIBUTORS BE > >> > > > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, > >> > > > OR > >> > > > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, > >> > > > PROCUREMENT OF > >> > > > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > >> > > > BUSINESS > >> > > > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > >> > > > WHETHER IN > >> > > > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > >> > > > OTHERWISE) > >> > > > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > >> > > > ADVISED OF THE > >> > > > + * POSSIBILITY OF SUCH DAMAGE. > >> > > > + */ > >> > > > + > >> > > > +#ifdef HAVE_CONFIG_H > >> > > > +#include "config.h" > >> > > > +#endif > >> > > > + > >> > > > +#include <rtems/test.h> > >> > > > +#include <inttypes.h> > >> > > > +#include <stdio.h> > >> > > > +#include <errno.h> > >> > > > +#include <tmacros.h> > >> > > > +#include <stdint.h> > >> > > > +#include <stddef.h> > >> > > > + > >> > > > +const char rtems_test_name[] = "PSXINTTYPE 01"; > >> > > > + > >> > > > +/* forward declarations to avoid warnings */ > >> > > > +rtems_task Init(rtems_task_argument ignored); > >> > > > + > >> > > > +rtems_task Init(rtems_task_argument ignored) > >> > > > +{ > >> > > > + int base = 10; > >> > > > + char *nptr1 = "123abc"; > >> > > > + char *endptr1 = NULL; > >> > > > + wchar_t *nptr2 = L"-123junk"; > >> > > > + wchar_t *endptr2 = NULL; > >> > > > + intmax_t status1; > >> > > > + uintmax_t status2; > >> > > > + > >> > > > + > >> > > > + TEST_BEGIN(); > >> > > > + > >> > > > + puts( "\nChecking invalid base value" ); > >> > > > + rtems_test_assert( base >=2 && base <= 36 ); > >> > > > + > >> > > > + /*Test for strtoimax */ > >> > > > + puts( "Strtoimax Testcases...." ); > >> > > > + puts( "Generating Status" ); > >> > > > + status1 = strtoimax( nptr1, &endptr1, base ); > >> > > > + > >> > > > + rtems_test_assert( status1 != 0); > >> > > > + rtems_test_assert( base != EINVAL); > >> > > > + > >> > > > + puts( "Checking Garbage end of endptr" ); > >> > > > + rtems_test_assert( *endptr1 != '\0' ); > >> > > > + > >> > > > + puts( "Checking Underflow Case" ); > >> > > > + rtems_test_assert( status1 >= INTMAX_MIN ); > >> > > > + > >> > > > + puts( "Checking Overflow Case" ); > >> > > > + rtems_test_assert( status1 <= INTMAX_MAX ) ; > >> > > > + > >> > > > + printf( "status = %jd \n" , status1 ); > >> > > > + > >> > > > + /*Test for strtoumax */ > >> > > > + puts( "Strtoumax Testcases...." ); > >> > > > + puts( "Generating Status" ); > >> > > > + status2 = strtoumax( nptr1, &endptr1, base ); > >> > > > + > >> > > > + rtems_test_assert( status2 != 0); > >> > > > + rtems_test_assert( base != EINVAL); > >> > > > + > >> > > > + puts( "Checking Garbage end of endptr" ); > >> > > > + rtems_test_assert( *endptr1 != '\0' ); > >> > > > + > >> > > > + puts( "Checking Overflow Case" ); > >> > > > + rtems_test_assert( status2 <= UINTMAX_MAX ); > >> > > > + > >> > > > + printf( "status = %ju \n", status2 ); > >> > > > + > >> > > > + /*Test for wcstoimax */ > >> > > > + puts( "Wcstoimax Testcases...." ); > >> > > > + puts( "Generating Status" ); > >> > > > + status1 = wcstoimax( nptr2, &endptr2, base ); > >> > > > + > >> > > > + rtems_test_assert( status1 != 0); > >> > > > + rtems_test_assert( base != EINVAL); > >> > > > + > >> > > > + puts( "Checking Garbage end of endptr" ); > >> > > > + rtems_test_assert( *endptr2 != '\0' ); > >> > > > + > >> > > > + puts( "Checking Underflow Case" ); > >> > > > + rtems_test_assert( status1 >= INTMAX_MIN ); > >> > > > + > >> > > > + puts( "Checking Overflow Case" ); > >> > > > + rtems_test_assert( status1 <= INTMAX_MAX ) ; > >> > > > + > >> > > > + printf( "status = %jd \n", status1 ); > >> > > > + > >> > > > + /*Test for wcstoumax */ > >> > > > + puts( "wcstoumax Testcases...." ); > >> > > > + puts( "Generating Status" ); > >> > > > + status2 = wcstoumax( nptr2, &endptr2, base ); > >> > > > + > >> > > > + rtems_test_assert( status2 != 0); > >> > > > + rtems_test_assert( base != EINVAL); > >> > > > + > >> > > > + puts( "Checking Garbage end of endptr" ); > >> > > > + rtems_test_assert( *endptr2 != '\0' ); > >> > > > + > >> > > > + puts( "Checking Overflow Case" ); > >> > > > + rtems_test_assert( status2 <= UINTMAX_MAX ); > >> > > > + > >> > > > + printf( "status = %ju \n", status2 ); > >> > > > + > >> > > > + > >> > > > + TEST_END(); > >> > > > + rtems_test_exit(0); > >> > > > + > >> > > > +} > >> > > > + > >> > > > +/* NOTICE: the clock driver is explicitly disabled */ > >> > > > + > >> > > > +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER > >> > > > +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER > >> > > > + > >> > > > +#define CONFIGURE_MAXIMUM_TASKS 1 > >> > > > + > >> > > > +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE > >> > > > + > >> > > > +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION > >> > > > + > >> > > > +#define CONFIGURE_INIT > >> > > > +#include <rtems/confdefs.h> > >> > > > diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.doc > >> > > > b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc > >> > > > new file mode 100644 > >> > > > index 0000000000..f9e0951786 > >> > > > --- /dev/null > >> > > > +++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.doc > >> > > > @@ -0,0 +1,57 @@ > >> > > > +/** > >> > > > + * @file > >> > > > + * @brief Doc for Test suite for inttypes.h methods > >> > > > + */ > >> > > > + > >> > > > +/* > >> > > > + * SPDX-License-Identifier: BSD-2-Clause > >> > > > + * > >> > > > + * Copyright (C) 2019, Vaibhav Gupta > >> > > > + * > >> > > > + * Redistribution and use in source and binary forms, with or > >> > > > without > >> > > > + * modification, are permitted provided that the following > >> > > > conditions > >> > > > + * are met: > >> > > > + * 1. Redistributions of source code must retain the above copyright > >> > > > + * notice, this list of conditions and the following disclaimer. > >> > > > + * 2. Redistributions in binary form must reproduce the above > >> > > > copyright > >> > > > + * notice, this list of conditions and the following disclaimer > >> > > > in the > >> > > > + * documentation and/or other materials provided with the > >> > > > distribution. > >> > > > + * > >> > > > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > >> > > > CONTRIBUTORS "AS IS" > >> > > > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > >> > > > LIMITED TO, THE > >> > > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > >> > > > PARTICULAR PURPOSE > >> > > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR > >> > > > CONTRIBUTORS BE > >> > > > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, > >> > > > OR > >> > > > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, > >> > > > PROCUREMENT OF > >> > > > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > >> > > > BUSINESS > >> > > > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > >> > > > WHETHER IN > >> > > > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > >> > > > OTHERWISE) > >> > > > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > >> > > > ADVISED OF THE > >> > > > + * POSSIBILITY OF SUCH DAMAGE. > >> > > > + */ > >> > > > + > >> > > > +This File describes the concepts tested by this test suite. > >> > > > + > >> > > > +inttypes.h - fixed size integer types > >> > > > + > >> > > > +test suite name: PSXINTTYPE 01 > >> > > > + > >> > > > +- Checks for invalid base value > >> > > > + > >> > > > +- Checks for Strtoimax Testcases > >> > > > + - checks for Garbage end of endptr > >> > > > + - checks for Underflow Case > >> > > > + - checks for Overflow Case > >> > > > + > >> > > > +- Checks for Strtoumax Test Cases > >> > > > + - checks for Garbage end of endptr > >> > > > + - checks for Overflow Case > >> > > > + > >> > > > +- Checks for Wcstoimax Testcases > >> > > > + - checks for Garbage end of endptr > >> > > > + - checks for Underflow Case > >> > > > + - checks for Overflow Case > >> > > > + > >> > > > +- Checks for Wcstoumax Testcases > >> > > > + - checks for Garbage end of endptr > >> > > > + - checks for Overflow Case > >> > > > diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn > >> > > > b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn > >> > > > new file mode 100644 > >> > > > index 0000000000..cdd56b327d > >> > > > --- /dev/null > >> > > > +++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn > >> > > > @@ -0,0 +1,28 @@ > >> > > > +*** PSXINTTYPE 01 TEST *** > >> > > > + > >> > > > +Checking invalid base value > >> > > > +Strtoimax Testcases.... > >> > > > +Generating Status > >> > > > +Checking Garbage end of endptr > >> > > > +Checking Underflow Case > >> > > > +Checking Overflow Case > >> > > > +status = 123 > >> > > > +Strtoumax Testcases.... > >> > > > +Generating Status > >> > > > +Checking Garbage end of endptr > >> > > > +Checking Overflow Case > >> > > > +status = 123 > >> > > > +Wcstoimax Testcases.... > >> > > > +Generating Status > >> > > > +Checking Garbage end of endptr > >> > > > +Checking Underflow Case > >> > > > +Checking Overflow Case > >> > > > +status = -123 > >> > > > +wcstoumax Testcases.... > >> > > > +Generating Status > >> > > > +Checking Garbage end of endptr > >> > > > +Checking Overflow Case > >> > > > +status = 18446744073709551493 > >> > > > + > >> > > > +*** END OF PSXINTTYPE 01 TEST *** > >> > > > + > >> > > > -- > >> > > > 2.21.0 > >> > > > _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel