[PATCH v6] ndbm test suite

Vaibhav Gupta vaibhavgupta40 at gmail.com
Mon Jul 29 18:06:32 UTC 2019


On Mon, Jul 29, 2019 at 10:44 PM Joel Sherrill <joel at rtems.org> wrote:

>
>
> On Mon, Jul 29, 2019 at 11:35 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
> wrote:
>
>> Thanks Joel!
>> .
>> Now when the testsuite patch is successfully accepted, I would like
>> to add an example in:
>> https://devel.rtems.org/wiki/Developer/Coding/80_characters_per_line,
>> about wrapping a "function call" in "80 characters per line".
>>
>
> Pull. I pushed the test. It just won't get built unless your toolset has
> ndbm.h
>
> Thanks

> This sounds like helpful guidance.
>
> What's next for fenv?
>
I am following what You and Gedare suggested me. I won't directly import
fenv files,
as sources are mixed (FreeBSD and NetBSD), I am trying to unify them.
.
I will be approaching in this manner:

   1. I will make a header file     `libc/include/fenv.h`. All function
   definitons will be mentioned. All definitons/macros which are architecture
   specific will be kept between  #if /  #elif  /  #else  directives.
   2. Make architecture specific folders where I will Place   `fenv.c`
   files.

- Vaibhav  Gupta

>
>
>> .
>> Gedare and me discussed about it on a thread. That time he guided me for
>> this
>> as there is no example about in on the trac pag.
>> .
>> Vaibhav Gupta
>>
>>
>> On Mon, Jul 29, 2019 at 9:33 PM Joel Sherrill <joel at rtems.org> wrote:
>>
>>> Hi
>>>
>>> Now pushed. Thanks.
>>>
>>> I finally got a local sparc tool chain built with the git master of
>>> newlib to build and run this test. It was a bit more complicated than I
>>> expected.
>>>
>>> I did add a bit of logic to the psxtests configure.ac and Makefile.am
>>> to ensure the test was not built unless the toolset included <ndbm.h>. This
>>> ensures that builds don't break when the toolset doesn't include it and
>>> that git bisect will continue to work.
>>>
>>> The RSB will need to be bumped to the git master once the github mirror
>>> updates to include my push to libm.
>>>
>>> On Thu, Jul 25, 2019 at 2:34 PM Joel Sherrill <joel at rtems.org> wrote:
>>>
>>>> Hi
>>>>
>>>> I just wanted to let everyone know that I have this pending on a branch
>>>> and can build it using the current but there is a problem linking libm on
>>>> the newlib git master. Once I have the RSB updated, I will look at pushing
>>>> this.
>>>>
>>>> To let Vaibhav continue pushing on fenv, if we decide the configure.ac
>>>> should check for the newly added dbm methods before building the test, I
>>>> will merge that into the patch.
>>>>
>>>> --joel
>>>>
>>>> On Tue, Jul 23, 2019 at 8:42 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
>>>> wrote:
>>>>
>>>>> ---
>>>>>  testsuites/psxtests/Makefile.am             |   9 +
>>>>>  testsuites/psxtests/configure.ac            |   1 +
>>>>>  testsuites/psxtests/psxndbm01/init.c        | 299 ++++++++++++++++++++
>>>>>  testsuites/psxtests/psxndbm01/psxndbm01.doc |  36 +++
>>>>>  testsuites/psxtests/psxndbm01/psxndbm01.scn |  29 ++
>>>>>  5 files changed, 374 insertions(+)
>>>>>  create mode 100644 testsuites/psxtests/psxndbm01/init.c
>>>>>  create mode 100644 testsuites/psxtests/psxndbm01/psxndbm01.doc
>>>>>  create mode 100644 testsuites/psxtests/psxndbm01/psxndbm01.scn
>>>>>
>>>>> diff --git a/testsuites/psxtests/Makefile.am
>>>>> b/testsuites/psxtests/Makefile.am
>>>>> index 59c9f2085b..36da591ccc 100755
>>>>> --- a/testsuites/psxtests/Makefile.am
>>>>> +++ b/testsuites/psxtests/Makefile.am
>>>>> @@ -694,6 +694,15 @@ psxmutexattr01_CPPFLAGS = $(AM_CPPFLAGS)
>>>>> $(TEST_FLAGS_psxmutexattr01) \
>>>>>         $(support_includes) -I$(top_srcdir)/include
>>>>>  endif
>>>>>
>>>>> +if TEST_psxndbm01
>>>>> +psx_tests += psxndbm01
>>>>> +psx_screens += psxndbm01/psxndbm01.scn
>>>>> +psx_docs += psxndbm01/psxndbm01.doc
>>>>> +psxndbm01_SOURCES = psxndbm01/init.c
>>>>> +psxndbm01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxndbm01) \
>>>>> +       $(support_includes)
>>>>> +endif
>>>>> +
>>>>>  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..a1eff4bd67
>>>>> --- /dev/null
>>>>> +++ b/testsuites/psxtests/psxndbm01/init.c
>>>>> @@ -0,0 +1,299 @@
>>>>> +/**
>>>>> + *  @file
>>>>> + *  @brief Test suite for ndbm.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
>>>>> +
>>>>> +/* header files are listed in lexical/lexicographical/alphabetical
>>>>> order */
>>>>> +
>>>>> +#include <errno.h>
>>>>> +#include <fcntl.h>      /* contains definitions of 'open_flags' */
>>>>> +#include <limits.h>
>>>>> +#include <ndbm.h>       /* contains declarations of ndbm methods */
>>>>> +#include <stddef.h>
>>>>> +#include <stdint.h>
>>>>> +#include <stdio.h>
>>>>> +#include <sys/stat.h>   /* contains definitions of 'file_mode' */
>>>>> +#include <string.h>
>>>>> +#include <rtems/test.h>
>>>>> +#include <tmacros.h>
>>>>> +
>>>>> +const char rtems_test_name[] = "PSXNDBM 01";
>>>>> +
>>>>> +#define NAME      "VARoDeK"
>>>>> +#define PHONE_NO  "123-321-777-888"
>>>>> +#define DB_NAME   "phones_test"
>>>>> +#define NAME2     "VG"
>>>>> +#define PHONE_NO2 "321-123-888-777"
>>>>> +
>>>>> +/* forward declarations to avoid warnings */
>>>>> +rtems_task Init(rtems_task_argument ignored);
>>>>> +
>>>>> +/*
>>>>> +* This Function takes DBM* as a argument and count the number of
>>>>> records in the
>>>>> +* database pointed by it.
>>>>> +*/
>>>>> +static int count_no_of_records( DBM *db_local )
>>>>> +{
>>>>> +  int count = 0;
>>>>> +  datum temp;
>>>>> +
>>>>> +  for (
>>>>> +    temp = dbm_firstkey( db_local );
>>>>> +    temp.dptr != NULL;
>>>>> +    temp = dbm_nextkey( db_local ), count++
>>>>> +  );
>>>>> +
>>>>> +  return count;
>>>>> +}
>>>>> +
>>>>> +/* Test Function Begins */
>>>>> +rtems_task Init(rtems_task_argument ignored)
>>>>> +{
>>>>> +  datum name          = { NAME, sizeof( NAME ) };
>>>>> +  datum put_phone_no  = { PHONE_NO, sizeof( PHONE_NO ) };
>>>>> +  datum name2         = { NAME2, sizeof( NAME2 ) };
>>>>> +  datum put_phone_no2 = { PHONE_NO2, sizeof( PHONE_NO2 ) };
>>>>> +
>>>>> +  datum get_phone_no, key;
>>>>> +
>>>>> +  int i;
>>>>> +  char *test_strings;
>>>>> +
>>>>> +  DBM *db;
>>>>> +
>>>>> +  TEST_BEGIN();
>>>>> +
>>>>> +/* A Simple test to check if ndbm methods are call-able */
>>>>> +
>>>>> +/*
>>>>> + * A Simple test to check if NDBM methods are call-able
>>>>> + *
>>>>> + * We will try to open a database and then close it.
>>>>> + * If it successful, hence we can have further tests.
>>>>> + * Also, while opening it for first time, will create that database,
>>>>> + * hence we will be able to test for 'O_RDWR | O_EXCL' case later.
>>>>> + * Meanwhile we will also store one record, this record will be
>>>>> helpful in
>>>>> + * further tests.
>>>>> + * And fetch it, to make sure if basic NDBM methods are working
>>>>> correctly.
>>>>> + */
>>>>> +
>>>>> +  puts( "\nOpen Database." );
>>>>> +  db = dbm_open( DB_NAME, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU );
>>>>> +  rtems_test_assert( db != NULL );
>>>>> +
>>>>> +  /* This data will be useful in further tests */
>>>>> +  puts( "Store Records in Database." );
>>>>> +  dbm_store( db, name, put_phone_no, DBM_INSERT );
>>>>> +
>>>>> +  puts( "Fetch Records from Database and check." );
>>>>> +  get_phone_no = dbm_fetch( db, name );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr, PHONE_NO
>>>>> ) == 0 );
>>>>> +
>>>>> +  puts( "Close Database." );
>>>>> +  dbm_close( db );
>>>>> +
>>>>> +/* dbm_open() */
>>>>> +
>>>>> +  puts( "\nTestcases for 'dbm_open()'." );
>>>>> +
>>>>> +/* The 'DB_NAME' is already created, hence 'O_RDWR | O_EXCL' should
>>>>> fail. */
>>>>> +  puts( "Use 'O_CREAT | O_EXCL' to open existing file and confirm
>>>>> error." );
>>>>> +  db = dbm_open( DB_NAME, O_RDWR | O_CREAT | O_EXCL, S_IRWXU );
>>>>> +  rtems_test_assert( db == NULL );
>>>>> +  rtems_test_assert( errno == EEXIST );
>>>>> +
>>>>> +/* Some implementations use 3 characters for the suffix and others use
>>>>> + * 4 characters for the suffix, applications should ensure that the
>>>>> maximum
>>>>> + * portable pathname length passed to dbm_open() is no greater than
>>>>> + * {PATH_MAX}-4 bytes, with the last component of the pathname no
>>>>> greater
>>>>> + * than {NAME_MAX}-4 bytes.
>>>>> + */
>>>>> +
>>>>> +/* inside 'ndbm.h' ; '#define  DBM_SUFFIX      ".db"' ;
>>>>> + * 2 alphabets and 1 period, hence 3 characters are used for suffix
>>>>> + * in this implementation.
>>>>> + */
>>>>> +
>>>>> +  puts( "Use path name larger than '{PATH_MAX}-3 bytes.' and confirm
>>>>> error." );
>>>>> +  test_strings = (char*)malloc( PATH_MAX - 2 );
>>>>> +  for ( i = 0; i < PATH_MAX - 3; i++ ) {
>>>>> +    test_strings[i] = 'r';
>>>>> +  }
>>>>> +  test_strings[i] = '\0';
>>>>> +  db = dbm_open(
>>>>> +                (const char*)test_strings,
>>>>> +                O_RDWR | O_CREAT | O_TRUNC,
>>>>> +                S_IRWXU
>>>>> +  );
>>>>> +  rtems_test_assert( db == NULL );
>>>>> +  rtems_test_assert( errno == ENAMETOOLONG );
>>>>> +  free( test_strings );
>>>>> +
>>>>> +/* database opened for write-only access opens the files for read and
>>>>> + * write access or it will fail.
>>>>> + */
>>>>> +
>>>>> +/* Implementation of __hash_open in newlib does not support
>>>>> `O_WRONLY` */
>>>>> +
>>>>> +  puts( "Open file with write access only and confirm error." );
>>>>> +  db = dbm_open( DB_NAME, O_WRONLY, S_IRWXU );
>>>>> +  rtems_test_assert( db == NULL );
>>>>> +  rtems_test_assert( errno == EINVAL );
>>>>> +
>>>>> +/* dbm_store() */
>>>>> +
>>>>> +  puts( "\nTestcases for 'dbm_store()'" );
>>>>> +  db = dbm_open( DB_NAME, O_RDWR, S_IRWXU );
>>>>> +  rtems_test_assert( db != NULL );
>>>>> +
>>>>> +  puts( "Insert new record with same key using 'DBM_INSERT' mode and "
>>>>> +        "confirm error." );
>>>>> +  rtems_test_assert( dbm_store( db, name, put_phone_no2, DBM_INSERT )
>>>>> == 1 );
>>>>> +
>>>>> +  get_phone_no = dbm_fetch( db, name );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr, PHONE_NO
>>>>> ) == 0 );
>>>>> +
>>>>> +  puts( "Insert new record with same key using 'DBM_REPLACE' mode and
>>>>> "
>>>>> +        "confirm changes." );
>>>>> +  rtems_test_assert( dbm_store( db, name, put_phone_no2, DBM_REPLACE
>>>>> ) == 0 );
>>>>> +
>>>>> +  get_phone_no = dbm_fetch( db, name );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr,
>>>>> PHONE_NO2 ) == 0 );
>>>>> +
>>>>> +/* Revert for next tests */
>>>>> +  rtems_test_assert( dbm_store( db, name, put_phone_no, DBM_REPLACE )
>>>>> == 0 );
>>>>> +
>>>>> +  puts( "Store a new record and "
>>>>> +        "confirm that total number of records is successful 2." );
>>>>> +  rtems_test_assert( dbm_store( db, name2, put_phone_no2, DBM_INSERT
>>>>> ) == 0 );
>>>>> +
>>>>> +/* Confirm number of records */
>>>>> +  rtems_test_assert( count_no_of_records( db ) == 2 );
>>>>> +
>>>>> +  dbm_close( db );
>>>>> +
>>>>> +/* dbm_fetch() */
>>>>> +
>>>>> +  puts( "\nTestcases for 'dbm_fetch()'" );
>>>>> +  db = dbm_open( DB_NAME, O_RDONLY, S_IRWXU );
>>>>> +  rtems_test_assert( db != NULL );
>>>>> +
>>>>> +  puts( "Fetch existing records and confirm results." );
>>>>> +  get_phone_no = dbm_fetch( db, name );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr, PHONE_NO
>>>>> ) == 0 );
>>>>> +
>>>>> +  get_phone_no = dbm_fetch( db, name2 );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr,
>>>>> PHONE_NO2 ) == 0 );
>>>>> +
>>>>> +  puts( "Fetch non-existing record and confirm error." );
>>>>> +  test_strings = (char*)malloc(6);
>>>>> +  strncpy( test_strings, "Hello", 5 );
>>>>> +
>>>>> +  test_strings[5] = '\0';
>>>>> +
>>>>> +/* The data pointed by test_string is now pointed by key.dptr */
>>>>> +  key.dptr = test_strings;
>>>>> +  key.dsize = sizeof( test_strings );
>>>>> +  get_phone_no = dbm_fetch( db, key );
>>>>> +  rtems_test_assert( get_phone_no.dptr == NULL );
>>>>> +  dbm_close( db );
>>>>> +
>>>>> +/* We need the 'key' object, hence we cannot free 'test_strings' */
>>>>> +
>>>>> +/* dbm_delete() */
>>>>> +
>>>>> +  puts( "\nTestcases for 'dbm_delete()'" );
>>>>> +  db = dbm_open( DB_NAME, O_RDWR, S_IRWXU );
>>>>> +  rtems_test_assert( db != NULL );
>>>>> +
>>>>> +  puts( "Delete non-existing record and confirm error." );
>>>>> +  rtems_test_assert( dbm_delete( db, key ) != 0 );
>>>>> +  free( test_strings );
>>>>> +  rtems_test_assert( count_no_of_records( db ) == 2);
>>>>> +
>>>>> +  puts( "Delete existing record and "
>>>>> +        "confirm that total number of records is successful 1." );
>>>>> +  rtems_test_assert( dbm_delete( db, name ) == 0 );
>>>>> +  rtems_test_assert( count_no_of_records( db ) == 1);
>>>>> +
>>>>> +  puts( "Confirm if correct record is deleted." );
>>>>> +  get_phone_no = dbm_fetch( db, name );
>>>>> +  rtems_test_assert( get_phone_no.dptr == NULL );
>>>>> +
>>>>> +/* record returned by 'dbm_firstkey()' should be the only record
>>>>> + * left, this should be checked to confirm correct working of
>>>>> + * 'dbm_firstkey()'.
>>>>> + * Check if the data is not corrupted after usage of 'dbm_delete()'
>>>>> + */
>>>>> +
>>>>> +  puts( "Check if the data is not corrupted after usage of
>>>>> 'dbm_delete()'." );
>>>>> +  get_phone_no = dbm_fetch( db, dbm_firstkey( db ) );
>>>>> +  rtems_test_assert( strcmp( (const char*)get_phone_no.dptr,
>>>>> PHONE_NO2 ) == 0 );
>>>>> +
>>>>> +/* Empty the database and then try to use 'dbm_firstkey()', the
>>>>> + * dptr pointer should point to NULL.
>>>>> + */
>>>>> +
>>>>> +  puts( "Empty records in database and check results of
>>>>> 'dbm_firstkey()'." );
>>>>> +  rtems_test_assert( dbm_delete( db, dbm_firstkey( db ) ) == 0 );
>>>>> +  key = dbm_firstkey( db );
>>>>> +  rtems_test_assert( key.dptr == NULL );
>>>>> +  dbm_close( db );
>>>>> +
>>>>> +/*
>>>>> +* All cases for 'dbm_firstkey()' and 'dbm_nextkey()' were tested while
>>>>> +* performing other tests.
>>>>> +* One such case be found in count_number_of_records() function.
>>>>> +*/
>>>>> +
>>>>> +  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 */
>>>>> diff --git a/testsuites/psxtests/psxndbm01/psxndbm01.doc
>>>>> b/testsuites/psxtests/psxndbm01/psxndbm01.doc
>>>>> new file mode 100644
>>>>> index 0000000000..cdaeb40911
>>>>> --- /dev/null
>>>>> +++ b/testsuites/psxtests/psxndbm01/psxndbm01.doc
>>>>> @@ -0,0 +1,36 @@
>>>>> +This File describes the concepts tested by this test suite.
>>>>> +
>>>>> +ndbm.h - routines to manage data files that contain key/data pairs.
>>>>> +
>>>>> +test suite name: PSXNDBM 01
>>>>> +
>>>>> +- A Simple test to check if NDBM methods are call-able.
>>>>> +  - Check if able to run the routine to Open Database.
>>>>> +  - Check if able to run the routine to store a record in database.
>>>>> +  - Check if able to run the routine to fetch a record from database.
>>>>> +  - Check if able to run the routine to close the database.
>>>>> +
>>>>> +- Test Cases for 'dbm_open()'.
>>>>> +  - Verify the error when trying to open existing file with 'O_RDWR |
>>>>> O_EXCL'
>>>>> +    flags.
>>>>> +  - Verify the error when trying to open file with pathname longer
>>>>> than
>>>>> +    {PATHMAX}-3 bytes.
>>>>> +  - Verify the error when trying to open file with only write access.
>>>>> +
>>>>> +- Test Cases for 'dbm_store()'.
>>>>> +  - Verify the error when trying to insert a record using same key
>>>>> with
>>>>> +    'DBM_INSERT' mode.
>>>>> +  - Verify the updated record when trying to insert a record using
>>>>> same key
>>>>> +    with 'DBM_REPLACE' mode.
>>>>> +  - Verify if able to save more than one record in database.
>>>>> +
>>>>> +- Test Cases for 'dbm_fetch()'.
>>>>> +  - Verify the data fetched from database.
>>>>> +  - Verify the error when tring to fetch non-existing record.
>>>>> +
>>>>> +- Test Cases for 'dbm_delete()'.
>>>>> +  - Veriy the error when trying to delete non-existing record.
>>>>> +  - Delete one record and verify results.
>>>>> +  - Check if correct record is deleted.
>>>>> +  - Verify if other data is not corrupted during delete.
>>>>> +  - Empty the databse and verify the value returned by
>>>>> 'dbm_firstkey()'.
>>>>> \ No newline at end of file
>>>>> diff --git a/testsuites/psxtests/psxndbm01/psxndbm01.scn
>>>>> b/testsuites/psxtests/psxndbm01/psxndbm01.scn
>>>>> new file mode 100644
>>>>> index 0000000000..3fa386630a
>>>>> --- /dev/null
>>>>> +++ b/testsuites/psxtests/psxndbm01/psxndbm01.scn
>>>>> @@ -0,0 +1,29 @@
>>>>> +*** PSXNDBM 01 Test ***
>>>>> +
>>>>> +Open Database.
>>>>> +Store Records in Database.
>>>>> +Fetch Records from Database and check.
>>>>> +Close Database.
>>>>> +
>>>>> +Testcases for 'dbm_open()'.
>>>>> +Use 'O_CREAT | O_EXCL' to open existing file and confirm error.
>>>>> +Use path name larger than '{PATH_MAX}-3 bytes.' and confirm error.
>>>>> +Open file with write access only and confirm error.
>>>>> +
>>>>> +Testcases for 'dbm_store()'
>>>>> +Insert new record with same key using 'DBM_INSERT' mode and confirm
>>>>> error.
>>>>> +Insert new record with same key using 'DBM_REPLACE' mode and confirm
>>>>> changes.
>>>>> +Store a new record and confirm that total number of records is
>>>>> successful 2.
>>>>> +
>>>>> +Testcases for 'dbm_fetch()'
>>>>> +Fetch existing records and confirm results.
>>>>> +Fetch non-existing record and confirm error.
>>>>> +
>>>>> +Testcases for 'dbm_delete()'
>>>>> +Delete non-existing record and confirm error.
>>>>> +Delete existing record and confirm that total number of records is
>>>>> successful 1.
>>>>> +Confirm if correct record is deleted.
>>>>> +Check if the data is not corrupted after usage of 'dbm_delete()'.
>>>>> +Empty records in database and check results of 'dbm_firstkey()'.
>>>>> +
>>>>> +*** END OF TEST PSXNDBM 01 ***
>>>>> \ No newline at end of file
>>>>> --
>>>>> 2.21.0
>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190729/83caa2c4/attachment-0001.html>


More information about the devel mailing list