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

Vaibhav Gupta vaibhavgupta40 at gmail.com
Thu Jul 4 08:30:24 UTC 2019


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.
========================
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?
.
.
.
.
.
========================
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
+
+
 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
+ */
+
+/*
+ * 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>
+
+
+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 );
+
+  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 );
+
+  puts( "Close Database" );
+  dbm_close( db );
+
+
+
+
+  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/20190704/0822139f/attachment-0001.html>


More information about the devel mailing list