[PATCH 0/1] Edited sig2str/str2sig tests per mentor feedback

2021-07-18 Thread Matt Joyce
Here is the new version of the psxsignal09 test and the compile only
test based on mentor's feedback.

Matt Joyce (1):
  testsuites: Added tests for sig2str/str2sig methods

 spec/build/testsuites/psxtests/grp.yml|   2 +
 spec/build/testsuites/psxtests/libpsxhdrs.yml |   1 +
 .../build/testsuites/psxtests/psxsignal09.yml |  21 ++
 testsuites/psxtests/Makefile.am   |  11 +
 testsuites/psxtests/configure.ac  |   1 +
 testsuites/psxtests/psxhdrs/signal/sig2str.c  |  58 
 testsuites/psxtests/psxsignal09/init.c| 251 ++
 .../psxtests/psxsignal09/psxsignal09.doc  |  35 +++
 .../psxtests/psxsignal09/psxsignal09.scn  |  33 +++
 9 files changed, 413 insertions(+)
 create mode 100644 spec/build/testsuites/psxtests/psxsignal09.yml
 create mode 100644 testsuites/psxtests/psxhdrs/signal/sig2str.c
 create mode 100644 testsuites/psxtests/psxsignal09/init.c
 create mode 100644 testsuites/psxtests/psxsignal09/psxsignal09.doc
 create mode 100644 testsuites/psxtests/psxsignal09/psxsignal09.scn

-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/1] testsuites: Added tests for sig2str/str2sig methods

2021-07-18 Thread Matt Joyce
Added psxsignal09 in psxtests and compile only test in psxhdrs in order to 
evaluate
newly added POSIX standard methods in Newlib.
---
 spec/build/testsuites/psxtests/grp.yml|   2 +
 spec/build/testsuites/psxtests/libpsxhdrs.yml |   1 +
 .../build/testsuites/psxtests/psxsignal09.yml |  21 ++
 testsuites/psxtests/Makefile.am   |  11 +
 testsuites/psxtests/configure.ac  |   1 +
 testsuites/psxtests/psxhdrs/signal/sig2str.c  |  58 
 testsuites/psxtests/psxsignal09/init.c| 251 ++
 .../psxtests/psxsignal09/psxsignal09.doc  |  35 +++
 .../psxtests/psxsignal09/psxsignal09.scn  |  33 +++
 9 files changed, 413 insertions(+)
 create mode 100644 spec/build/testsuites/psxtests/psxsignal09.yml
 create mode 100644 testsuites/psxtests/psxhdrs/signal/sig2str.c
 create mode 100644 testsuites/psxtests/psxsignal09/init.c
 create mode 100644 testsuites/psxtests/psxsignal09/psxsignal09.doc
 create mode 100644 testsuites/psxtests/psxsignal09/psxsignal09.scn

diff --git a/spec/build/testsuites/psxtests/grp.yml 
b/spec/build/testsuites/psxtests/grp.yml
index fb7ce465ae..f61f45dbe9 100644
--- a/spec/build/testsuites/psxtests/grp.yml
+++ b/spec/build/testsuites/psxtests/grp.yml
@@ -205,6 +205,8 @@ links:
   uid: psxsignal07
 - role: build-dependency
   uid: psxsignal08
+- role: build-dependency
+  uid: psxsignal09
 - role: build-dependency
   uid: psxspin01
 - role: build-dependency
diff --git a/spec/build/testsuites/psxtests/libpsxhdrs.yml 
b/spec/build/testsuites/psxtests/libpsxhdrs.yml
index 6a0ab6d4f7..5767bcdacd 100644
--- a/spec/build/testsuites/psxtests/libpsxhdrs.yml
+++ b/spec/build/testsuites/psxtests/libpsxhdrs.yml
@@ -513,6 +513,7 @@ source:
 - testsuites/psxtests/psxhdrs/signal/sigtimedwait.c
 - testsuites/psxtests/psxhdrs/signal/sigwait.c
 - testsuites/psxtests/psxhdrs/signal/sigwaitinfo.c
+- testsuites/psxtests/psxhdrs/signal/sig2str.c
 - testsuites/psxtests/psxhdrs/stddef/offsetof.c
 - testsuites/psxtests/psxhdrs/stdio/clearerr.c
 - testsuites/psxtests/psxhdrs/stdio/ctermid.c
diff --git a/spec/build/testsuites/psxtests/psxsignal09.yml 
b/spec/build/testsuites/psxtests/psxsignal09.yml
new file mode 100644
index 00..08a29c7c5b
--- /dev/null
+++ b/spec/build/testsuites/psxtests/psxsignal09.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: test-program
+cflags: []
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+cppflags: []
+cxxflags: []
+enabled-by:
+- RTEMS_POSIX_API
+features: c cprogram
+includes: []
+ldflags: []
+links: []
+source:
+- testsuites/psxtests/psxsignal09/init.c
+stlib: []
+target: testsuites/psxtests/psxsignal09.exe
+type: build
+use-after: []
+use-before: []
+
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index a35f00b665..b62d5cab59 100755
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -924,6 +924,17 @@ psxsignal08_CPPFLAGS = $(AM_CPPFLAGS) 
$(TEST_FLAGS_psxsignal08) \
 endif
 endif
 
+if HAS_POSIX
+if TEST_psxsignal09
+psx_tests += psxsignal09
+psx_screens += psxsignal09/psxsignal09.scn
+psx_docs += psxsignal09/psxsignal09.doc
+psxsignal09_SOURCES = psxsignal09/init.c 
+psxsignal09_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxsignal09) \
+   $(support_includes) -I$(top_srcdir)/include
+endif
+endif
+
 if TEST_psxspin01
 psx_tests += psxspin01
 psx_screens += psxspin01/psxspin01.scn
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 3f95010cd3..7b9a1027ca 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -138,6 +138,7 @@ RTEMS_TEST_CHECK([psxsignal05])
 RTEMS_TEST_CHECK([psxsignal06])
 RTEMS_TEST_CHECK([psxsignal07])
 RTEMS_TEST_CHECK([psxsignal08])
+RTEMS_TEST_CHECK([psxsignal09])
 RTEMS_TEST_CHECK([psxspin01])
 RTEMS_TEST_CHECK([psxstack01])
 RTEMS_TEST_CHECK([psxstack02])
diff --git a/testsuites/psxtests/psxhdrs/signal/sig2str.c 
b/testsuites/psxtests/psxhdrs/signal/sig2str.c
new file mode 100644
index 00..d4932c1961
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/signal/sig2str.c
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ * @brief Header File Conformance Test
+ *
+ * This test file is used to verify that the header files associated with
+ * invoking this function are correct.
+ */
+
+/*
+ * Copyright (C) 2021 Matthew Joyce
+ *
+ * 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 PR

Re: [PATCH] AddressToLineMapper.h: Remove pointer to temporary string

2021-07-18 Thread Chris Johns
Hi Alex,

This looks good and can be pushed. Thank you.

Chris

On 17/7/21 4:03 am, Alex White wrote:
> CID 1505281: Pointer to local outside scope
> 
> Closes #4473
> ---
>  tester/covoar/AddressToLineMapper.cc | 11 ---
>  tester/covoar/AddressToLineMapper.h  | 21 -
>  2 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/tester/covoar/AddressToLineMapper.cc 
> b/tester/covoar/AddressToLineMapper.cc
> index c305e3b..838b156 100644
> --- a/tester/covoar/AddressToLineMapper.cc
> +++ b/tester/covoar/AddressToLineMapper.cc
> @@ -19,9 +19,13 @@ namespace Coverage {
>  return is_end_sequence;
>}
>  
> -  const std::string& SourceLine::path() const
> +  const std::string SourceLine::path() const
>{
> -return path_;
> +if (!path_) {
> +  return "unknown";
> +} else {
> +  return *path_;
> +}
>}
>  
>int SourceLine::line() const
> @@ -31,7 +35,8 @@ namespace Coverage {
>  
>void AddressLineRange::addSourceLine(const rld::dwarf::address& address)
>{
> -auto insertResult = sourcePaths.insert(address.path());
> +auto insertResult = sourcePaths.insert(
> +  std::make_shared(address.path()));
>  
>  sourceLines.emplace_back(
>SourceLine (
> diff --git a/tester/covoar/AddressToLineMapper.h 
> b/tester/covoar/AddressToLineMapper.h
> index 88bf475..308925a 100644
> --- a/tester/covoar/AddressToLineMapper.h
> +++ b/tester/covoar/AddressToLineMapper.h
> @@ -8,6 +8,7 @@
>  #define __ADDRESS_TO_LINE_MAPPER_H__
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -26,7 +27,7 @@ namespace Coverage {
>  
>  SourceLine()
>  : address(0),
> -  path_("unknown"),
> +  path_(nullptr),
>line_num(-1),
>is_end_sequence(true)
>  {
> @@ -34,7 +35,7 @@ namespace Coverage {
>  
>  SourceLine(
>uint64_t addr,
> -  const std::string& src,
> +  const std::shared_ptr& src,
>int line,
>bool end_sequence
>  ) : address(addr),
> @@ -64,7 +65,7 @@ namespace Coverage {
>   *
>   *  @return Returns the source file path of this address
>   */
> -const std::string& path() const;
> +const std::string path() const;
>  
>  /*!
>   *  This method gets the source line number of this address.
> @@ -84,7 +85,7 @@ namespace Coverage {
>   *  An iterator pointing to the location in the set that contains the
>   *  source file path of the address.
>   */
> -const std::string& path_;
> +const std::shared_ptr path_;
>  
>  /*!
>   *  The source line number of the address.
> @@ -100,7 +101,17 @@ namespace Coverage {
>  
>typedef std::vector SourceLines;
>  
> -  typedef std::set SourcePaths;
> +  /* This allows comparison of strings owned by shared_ptrs. */
> +  struct SharedStringCmp {
> +bool operator()(
> +  const std::shared_ptr& lhs,
> +  const std::shared_ptr& rhs
> +) const {
> +  return *lhs < *rhs;
> +}
> +  };
> +
> +  typedef std::set, SharedStringCmp> 
> SourcePaths;
>  
>/*! @class AddressLineRange
> *
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel