GSoC 2019 | POSIX Compliance - NDBM Port Successful. Minimal Testsuite working Successfully.

Vaibhav Gupta vaibhavgupta40 at gmail.com
Fri Jul 5 17:11:27 UTC 2019


On Fri, Jul 5, 2019 at 10:20 PM Gedare Bloom <gedare at rtems.org> wrote:

> On Thu, Jul 4, 2019 at 2:31 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
> wrote:
> >
> > Hello,
> > As I mentioned in previous threads, RSB patch was not generating
> function symbols defined
> > in ndbm.c, but they were generated when I build newlib repository for
> SPARC.
> > .
> > .
> > So, I made a script to add them manually, from newlib build, to
> rtems/5/.....
> >
> https://github.com/VARoDeK/MiniProject_1-Add_newlib_object_files_to_rtems_libraries/blob/master/script.sh
> > .
> > .
> > The compilation of minimal Testsuite was Successful this time and is
> generating
> > expected correct results.
> Good.
>
Thanks :)

>
> > ========================
> > OUTPUT
> > ========================
> > *** BEGIN OF TEST PSXNDBM 01 ***
> > *** TEST VERSION: 5.0.0.5cbee18e0030981cd61b8c9d556cc5c57f6ee082-modified
> > *** TEST STATE: EXPECTED-PASS
> > *** TEST BUILD: RTEMS_POSIX_API
> > *** TEST TOOLS: 7.4.1 20190514 (RTEMS 5, RSB
> d694d16e5a7241827471af98c8f978ff3eb331fd, Newlib 5c2a3661c)
> > Open Database
> > Store Records in Database
> > Fetch Records from Database
> >
> > Name: VARoDeK,
> > Phone Number: 123-321-777-888
> >
> > Close Database
> >
> > *** END OF TEST PSXNDBM 01 ***
> >
> >
> > *** FATAL ***
> > fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
> > fatal code: 0 (0x00000000)
> > RTEMS version: 5.0.0.5cbee18e0030981cd61b8c9d556cc5c57f6ee082-modified
> > RTEMS tools: 7.4.1 20190514 (RTEMS 5, RSB
> d694d16e5a7241827471af98c8f978ff3eb331fd, Newlib 5c2a3661c)
> > executing thread ID: 0x08a010001
> > executing thread name: UI1
> > ========================
> > .
> > I will now make a Testsuite for each and every error and output.
> > Should I send the ndbm patch to newlib now?
> >
> Did you post the final ndbm here already? if so, which was it? Your
> mentors should take a good look before you will send it to newlib-ml
> to avoid any obvious problems. (Or else, Joel might get scolded by
> Corinna again. :))
>
No, I haven't send any patch to newlib for now.
There is no change in ndbm patch. Its same what I submitted last time. Its
just I added the `lib_a-ndbm.o` manually to the RTEMS libraries using shell
script.

> > .
> > .
> > .
> > .
> > ========================
> > Patch for Testsuite
> > ========================
> > ---
> >  testsuites/psxtests/Makefile.am      |   8 +++
> >  testsuites/psxtests/configure.ac     |   1 +
> >  testsuites/psxtests/psxndbm01/init.c | 103 +++++++++++++++++++++++++++
> >  3 files changed, 112 insertions(+)
> >  create mode 100644 testsuites/psxtests/psxndbm01/init.c
> >
> > diff --git a/testsuites/psxtests/Makefile.am
> b/testsuites/psxtests/Makefile.am
> > index 59c9f2085b..c805973afb 100755
> > --- a/testsuites/psxtests/Makefile.am
> > +++ b/testsuites/psxtests/Makefile.am
> > @@ -694,6 +694,14 @@ psxmutexattr01_CPPFLAGS = $(AM_CPPFLAGS)
> $(TEST_FLAGS_psxmutexattr01) \
> >   $(support_includes) -I$(top_srcdir)/include
> >  endif
> >
> > +if TEST_psxndbm01
> > +psx_tests += psxndbm01
> > +psxndbm01_SOURCES = psxndbm01/init.c
> > +psxndbm01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxndbm01) \
> > +       $(support_includes)
> > +endif
> > +
> > +
> only need 1 blank line to separate things, like in the rest of this file.
>
> >  if TEST_psxobj01
> >  psx_tests += psxobj01
> >  psx_screens += psxobj01/psxobj01.scn
> > diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/
> configure.ac
> > index 85559e4aa5..07d7ccaf55 100644
> > --- a/testsuites/psxtests/configure.ac
> > +++ b/testsuites/psxtests/configure.ac
> > @@ -110,6 +110,7 @@ RTEMS_TEST_CHECK([psxmsgq02])
> >  RTEMS_TEST_CHECK([psxmsgq03])
> >  RTEMS_TEST_CHECK([psxmsgq04])
> >  RTEMS_TEST_CHECK([psxmutexattr01])
> > +RTEMS_TEST_CHECK([psxndbm01])
> >  RTEMS_TEST_CHECK([psxobj01])
> >  RTEMS_TEST_CHECK([psxonce01])
> >  RTEMS_TEST_CHECK([psxpasswd01])
> > diff --git a/testsuites/psxtests/psxndbm01/init.c
> b/testsuites/psxtests/psxndbm01/init.c
> > new file mode 100644
> > index 0000000000..74dec0c969
> > --- /dev/null
> > +++ b/testsuites/psxtests/psxndbm01/init.c
> > @@ -0,0 +1,103 @@
> > +/**
> > + *  @file
> > + *  @brief Test suite for inttypes.h methods
> inttypes.h?
>
That mistake must have been caused by my hurry.

>
> > + */
> > +
> > +/*
> > + * 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 <errno.h>
> > +#include <fcntl.h>
> > +#include <ndbm.h>
> > +#include <stddef.h>
> > +#include <stdint.h>
> > +#include <stdio.h>
> > +#include <sys/stat.h>
> > +#include <rtems/test.h>
> > +#include <tmacros.h>
> > +
> > +
> Only need one blank line to separate things.
>
> > +const char rtems_test_name[] = "PSXNDBM 01";
> > +
> > +#define NAME     "VARoDeK"
> > +#define PHONE_NO "123-321-777-888"
> > +#define DB_NAME  "phones_test"
> > +
> > +/* forward declarations to avoid warnings */
> > +rtems_task Init(rtems_task_argument ignored);
> > +DBM *db;
> > +
> > +rtems_task Init(rtems_task_argument ignored)
> > +{
> > +  datum name = { NAME , sizeof(NAME) };
> > +  datum put_phone_no = { PHONE_NO, sizeof(PHONE_NO) };
> > +  datum get_phone_no;
> > +
> > +  TEST_BEGIN();
> > +
> > +  puts( "Open Database" );
> > +  db = dbm_open( DB_NAME , O_RDWR | O_CREAT | O_TRUNC , S_IRWXU );
> > +  rtems_test_assert( db != NULL );
> > +
> > +  puts( "Store Records in Database" );
> > +  dbm_store( db , name , put_phone_no , DBM_INSERT );
> > +
> Can you check this call for any return value / errors?
>
for this scenerio, I just wanted to check If I am able to call ndbm
functions.

>
> > +  puts( "Fetch Records from Database" );
> > +  get_phone_no = dbm_fetch( db , name );
> > +  printf( "\nName: %s, \nPhone Number: %s\n\n", (char *)name.dptr ,
> (char *)get_phone_no.dptr );
> > +
> How do you determine the test is successful?  You must manually view
> the output?  Can you make this test to fail in case the dbm_fetch is
> wrong?
>
Yah, as I mentioned, this is a minimal test.
.
Actually, as discussed in previous meetings, i was not able to run ndbm
tests
due to `undefined reference` error.
.
So I was trying multiple solutions.
Finally I decided to add `lib_a-ndbm.o`, manually to RTEMS libraries.
.
Just have a loot at my Script:
https://github.com/VARoDeK/MiniProject_1-Add_newlib_object_files_to_rtems_libraries/blob/master/script.sh
To try If its working or not (am i able to call ndbm functions?), I made
minimal tests.
.
All the blank lines and formatting mistakes, its because of my hurry as,
I was trying multiple solutions to make it run.
.
Now it worked, So will make a good testsuite, considering all errors and
outputs and all functions.
.
I will make sure, to not to make any formatting erros. and other errors too
:)

>
> > +  puts( "Close Database" );
> > +  dbm_close( db );
> > +
> > +
> > +
> > +
> 1 blank line only
>
> > +  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_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6
> > +
> > +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> > +
> > +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
> > +
> > +#define CONFIGURE_INIT
> > +#include <rtems/confdefs.h>
> > +/* end of file */
> > --
> > 2.21.0
> > ========================
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190705/c141b64a/attachment-0002.html>


More information about the devel mailing list