Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-22 Thread Christian Mauderer

Hello Niteesh,

Am 20.11.20 um 20:18 schrieb Niteesh G. S.:
On Fri, Nov 20, 2020 at 2:50 PM Christian Mauderer 
> wrote:


On a last test before I wanted to push it, I found a problem
(sorry). On
BSPs that rely on a FDT the test doesn't work:

No problem :).

You wrap bsp_fdt_get and return another FDT. So as soon as one
driver of
the BSP needs the original FDT, that driver won't work any more.

I think I remember that problem from the Beagle too. Didn't you have a
version where you have enabled the wrapper later? If not: I added a
suggestion below.

Really sorry since it has been a couple of months now I don't exactly
remember what all I tried.


No problem. It's partial my fault that it needed that much time.




Am 03.11.20 um 19:18 schrieb G S Niteesh Babu:
 > Added a basic test for the implemented RTEMS OFW
 > API.
 > ---
 >   spec/build/testsuites/libtests/grp.yml   |   2 +
 >   spec/build/testsuites/libtests/ofw01.yml |  21 +++
 >   testsuites/libtests/ofw01/init.c         | 187
+++
 >   testsuites/libtests/ofw01/ofw01.doc      |  29 
 >   testsuites/libtests/ofw01/ofw01.scn      |   2 +
 >   testsuites/libtests/ofw01/some.c         |  72 +
 >   testsuites/libtests/ofw01/some.dts       |  76 +
 >   testsuites/libtests/ofw01/some.h         |  15 ++
 >   8 files changed, 404 insertions(+)
 >   create mode 100644 spec/build/testsuites/libtests/ofw01.yml
 >   create mode 100644 testsuites/libtests/ofw01/init.c
 >   create mode 100644 testsuites/libtests/ofw01/ofw01.doc
 >   create mode 100644 testsuites/libtests/ofw01/ofw01.scn
 >   create mode 100644 testsuites/libtests/ofw01/some.c
 >   create mode 100644 testsuites/libtests/ofw01/some.dts
 >   create mode 100644 testsuites/libtests/ofw01/some.h
 >
 > diff --git a/spec/build/testsuites/libtests/grp.yml
b/spec/build/testsuites/libtests/grp.yml
 > index b9ca014b0d..1aa136854a 100644
 > --- a/spec/build/testsuites/libtests/grp.yml
 > +++ b/spec/build/testsuites/libtests/grp.yml
 > @@ -316,6 +316,8 @@ links:
 >     uid: write
 >   - role: build-dependency
 >     uid: writev
 > +- role: build-dependency
 > +  uid: ofw01
 >   type: build
 >   use-after:
 >   - rtemstest
 > diff --git a/spec/build/testsuites/libtests/ofw01.yml
b/spec/build/testsuites/libtests/ofw01.yml
 > new file mode 100644
 > index 00..8517c58bad
 > --- /dev/null
 > +++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
 > +cppflags: []
 > +cxxflags: []
 > +enabled-by: true
 > +features: c cprogram
 > +includes: []
 > +ldflags:
 > +- -Wl,--wrap=bsp_fdt_get
 > +links: []
 > +source:
 > +- testsuites/libtests/ofw01/init.c
 > +- testsuites/libtests/ofw01/some.c
 > +stlib: []
 > +target: testsuites/libtests/ofw01.exe
 > +type: build
 > +use-after: []
 > +use-before: []
 > diff --git a/testsuites/libtests/ofw01/init.c
b/testsuites/libtests/ofw01/init.c
 > new file mode 100644
 > index 00..82ee5eb11f
 > --- /dev/null
 > +++ b/testsuites/libtests/ofw01/init.c
 > @@ -0,0 +1,187 @@
 > +/* SPDX-License-Identifier: BSD-2-Clause */
 > +
 > +/*
 > + * Copyright (C) <2020> Niteesh G S mailto:niteesh...@gmail.com>>
 > + *
 > + * 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
   

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-20 Thread Niteesh G. S.
On Fri, Nov 20, 2020 at 2:50 PM Christian Mauderer <
christian.maude...@embedded-brains.de> wrote:

> On a last test before I wanted to push it, I found a problem (sorry). On
> BSPs that rely on a FDT the test doesn't work:
>
No problem :).



> You wrap bsp_fdt_get and return another FDT. So as soon as one driver of
> the BSP needs the original FDT, that driver won't work any more.
>
> I think I remember that problem from the Beagle too. Didn't you have a
> version where you have enabled the wrapper later? If not: I added a
> suggestion below.

Really sorry since it has been a couple of months now I don't exactly
remember what all I tried.

>
> Am 03.11.20 um 19:18 schrieb G S Niteesh Babu:
> > Added a basic test for the implemented RTEMS OFW
> > API.
> > ---
> >   spec/build/testsuites/libtests/grp.yml   |   2 +
> >   spec/build/testsuites/libtests/ofw01.yml |  21 +++
> >   testsuites/libtests/ofw01/init.c | 187 +++
> >   testsuites/libtests/ofw01/ofw01.doc  |  29 
> >   testsuites/libtests/ofw01/ofw01.scn  |   2 +
> >   testsuites/libtests/ofw01/some.c |  72 +
> >   testsuites/libtests/ofw01/some.dts   |  76 +
> >   testsuites/libtests/ofw01/some.h |  15 ++
> >   8 files changed, 404 insertions(+)
> >   create mode 100644 spec/build/testsuites/libtests/ofw01.yml
> >   create mode 100644 testsuites/libtests/ofw01/init.c
> >   create mode 100644 testsuites/libtests/ofw01/ofw01.doc
> >   create mode 100644 testsuites/libtests/ofw01/ofw01.scn
> >   create mode 100644 testsuites/libtests/ofw01/some.c
> >   create mode 100644 testsuites/libtests/ofw01/some.dts
> >   create mode 100644 testsuites/libtests/ofw01/some.h
> >
> > diff --git a/spec/build/testsuites/libtests/grp.yml
> b/spec/build/testsuites/libtests/grp.yml
> > index b9ca014b0d..1aa136854a 100644
> > --- a/spec/build/testsuites/libtests/grp.yml
> > +++ b/spec/build/testsuites/libtests/grp.yml
> > @@ -316,6 +316,8 @@ links:
> > uid: write
> >   - role: build-dependency
> > uid: writev
> > +- role: build-dependency
> > +  uid: ofw01
> >   type: build
> >   use-after:
> >   - rtemstest
> > diff --git a/spec/build/testsuites/libtests/ofw01.yml
> b/spec/build/testsuites/libtests/ofw01.yml
> > new file mode 100644
> > index 00..8517c58bad
> > --- /dev/null
> > +++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
> > +cppflags: []
> > +cxxflags: []
> > +enabled-by: true
> > +features: c cprogram
> > +includes: []
> > +ldflags:
> > +- -Wl,--wrap=bsp_fdt_get
> > +links: []
> > +source:
> > +- testsuites/libtests/ofw01/init.c
> > +- testsuites/libtests/ofw01/some.c
> > +stlib: []
> > +target: testsuites/libtests/ofw01.exe
> > +type: build
> > +use-after: []
> > +use-before: []
> > diff --git a/testsuites/libtests/ofw01/init.c
> b/testsuites/libtests/ofw01/init.c
> > new file mode 100644
> > index 00..82ee5eb11f
> > --- /dev/null
> > +++ b/testsuites/libtests/ofw01/init.c
> > @@ -0,0 +1,187 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +
> > +/*
> > + * Copyright (C) <2020> Niteesh G S 
> > + *
> > + * 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 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "some.h"
> > +
> > +#define BUF_SIZE 100
> > +
> > +const char rtems_test_name[] = "OFW 

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-20 Thread Christian Mauderer
On a last test before I wanted to push it, I found a problem (sorry). On 
BSPs that rely on a FDT the test doesn't work:


You wrap bsp_fdt_get and return another FDT. So as soon as one driver of 
the BSP needs the original FDT, that driver won't work any more.


I think I remember that problem from the Beagle too. Didn't you have a 
version where you have enabled the wrapper later? If not: I added a 
suggestion below.


Am 03.11.20 um 19:18 schrieb G S Niteesh Babu:

Added a basic test for the implemented RTEMS OFW
API.
---
  spec/build/testsuites/libtests/grp.yml   |   2 +
  spec/build/testsuites/libtests/ofw01.yml |  21 +++
  testsuites/libtests/ofw01/init.c | 187 +++
  testsuites/libtests/ofw01/ofw01.doc  |  29 
  testsuites/libtests/ofw01/ofw01.scn  |   2 +
  testsuites/libtests/ofw01/some.c |  72 +
  testsuites/libtests/ofw01/some.dts   |  76 +
  testsuites/libtests/ofw01/some.h |  15 ++
  8 files changed, 404 insertions(+)
  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
  create mode 100644 testsuites/libtests/ofw01/init.c
  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
  create mode 100644 testsuites/libtests/ofw01/some.c
  create mode 100644 testsuites/libtests/ofw01/some.dts
  create mode 100644 testsuites/libtests/ofw01/some.h

diff --git a/spec/build/testsuites/libtests/grp.yml 
b/spec/build/testsuites/libtests/grp.yml
index b9ca014b0d..1aa136854a 100644
--- a/spec/build/testsuites/libtests/grp.yml
+++ b/spec/build/testsuites/libtests/grp.yml
@@ -316,6 +316,8 @@ links:
uid: write
  - role: build-dependency
uid: writev
+- role: build-dependency
+  uid: ofw01
  type: build
  use-after:
  - rtemstest
diff --git a/spec/build/testsuites/libtests/ofw01.yml 
b/spec/build/testsuites/libtests/ofw01.yml
new file mode 100644
index 00..8517c58bad
--- /dev/null
+++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
+cppflags: []
+cxxflags: []
+enabled-by: true
+features: c cprogram
+includes: []
+ldflags:
+- -Wl,--wrap=bsp_fdt_get
+links: []
+source:
+- testsuites/libtests/ofw01/init.c
+- testsuites/libtests/ofw01/some.c
+stlib: []
+target: testsuites/libtests/ofw01.exe
+type: build
+use-after: []
+use-before: []
diff --git a/testsuites/libtests/ofw01/init.c b/testsuites/libtests/ofw01/init.c
new file mode 100644
index 00..82ee5eb11f
--- /dev/null
+++ b/testsuites/libtests/ofw01/init.c
@@ -0,0 +1,187 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) <2020> Niteesh G S 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "some.h"
+
+#define BUF_SIZE 100
+
+const char rtems_test_name[] = "OFW 01";
+
+const void *__wrap_bsp_fdt_get(void);
+const void *__real_bsp_fdt_get(void);
+
+const void *__wrap_bsp_fdt_get(void)
+{
+  if (some_bin != NULL) {


Instead of some_bin: Add another pointer like "test_fdt". That should be 
initialized with NULL and should be set to "some_bin" in Init ...



+return _bin[0];
+  }
+
+  return __real_bsp_fdt_get();
+}
+
+static void Init(rtems_task_argument arg)
+{
+  int rv;
+  phandle_t d;
+  phandle_t l;
+  phandle_t t;
+  phandle_t c;
+  phandle_t a;
+  phandle_t b;
+  phandle_t q;
+  phandle_t root;
+  phandle_t temp;
+  uint32_t *arr;
+  char buf[BUF_SIZE];
+  char *bufp;
+  ssize_t buf_len;
+  rtems_ofw_memory_area reg;
+  

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-09 Thread Niteesh G. S.
Hello Christian,

On Tue, Nov 10, 2020 at 12:59 AM Christian Mauderer 
wrote:

> Hello Niteesh,
>
> I've seen the patches. I have to run a test at least on one BSP with and
> one without a FDT to make sure they don't break test runs.
>
OK Great. Please take your time. I just wanted to make sure you saw these
patches.

Thanks,
Niteesh.



> Best regards
>
> Christian
>
> On 09/11/2020 04:45, Niteesh G. S. wrote:
> > Hello,
> >
> > Pinging again incase this patch missed your attention.
> >
> > Thanks,
> > Niteesh.
> >
> > On Tue, Nov 3, 2020 at 11:49 PM G S Niteesh Babu  > > wrote:
> >
> > Added a basic test for the implemented RTEMS OFW
> > API.
> > ---
> >  spec/build/testsuites/libtests/grp.yml   |   2 +
> >  spec/build/testsuites/libtests/ofw01.yml |  21 +++
> >  testsuites/libtests/ofw01/init.c | 187
> +++
> >  testsuites/libtests/ofw01/ofw01.doc  |  29 
> >  testsuites/libtests/ofw01/ofw01.scn  |   2 +
> >  testsuites/libtests/ofw01/some.c |  72 +
> >  testsuites/libtests/ofw01/some.dts   |  76 +
> >  testsuites/libtests/ofw01/some.h |  15 ++
> >  8 files changed, 404 insertions(+)
> >  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
> >  create mode 100644 testsuites/libtests/ofw01/init.c
> >  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
> >  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
> >  create mode 100644 testsuites/libtests/ofw01/some.c
> >  create mode 100644 testsuites/libtests/ofw01/some.dts
> >  create mode 100644 testsuites/libtests/ofw01/some.h
> >
> > diff --git a/spec/build/testsuites/libtests/grp.yml
> > b/spec/build/testsuites/libtests/grp.yml
> > index b9ca014b0d..1aa136854a 100644
> > --- a/spec/build/testsuites/libtests/grp.yml
> > +++ b/spec/build/testsuites/libtests/grp.yml
> > @@ -316,6 +316,8 @@ links:
> >uid: write
> >  - role: build-dependency
> >uid: writev
> > +- role: build-dependency
> > +  uid: ofw01
> >  type: build
> >  use-after:
> >  - rtemstest
> > diff --git a/spec/build/testsuites/libtests/ofw01.yml
> > b/spec/build/testsuites/libtests/ofw01.yml
> > new file mode 100644
> > index 00..8517c58bad
> > --- /dev/null
> > +++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
> > +cppflags: []
> > +cxxflags: []
> > +enabled-by: true
> > +features: c cprogram
> > +includes: []
> > +ldflags:
> > +- -Wl,--wrap=bsp_fdt_get
> > +links: []
> > +source:
> > +- testsuites/libtests/ofw01/init.c
> > +- testsuites/libtests/ofw01/some.c
> > +stlib: []
> > +target: testsuites/libtests/ofw01.exe
> > +type: build
> > +use-after: []
> > +use-before: []
> > diff --git a/testsuites/libtests/ofw01/init.c
> > b/testsuites/libtests/ofw01/init.c
> > new file mode 100644
> > index 00..82ee5eb11f
> > --- /dev/null
> > +++ b/testsuites/libtests/ofw01/init.c
> > @@ -0,0 +1,187 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +
> > +/*
> > + * Copyright (C) <2020> Niteesh G S  > >
> > + *
> > + * 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 

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-09 Thread Christian Mauderer
Hello Niteesh,

I've seen the patches. I have to run a test at least on one BSP with and
one without a FDT to make sure they don't break test runs.

Best regards

Christian

On 09/11/2020 04:45, Niteesh G. S. wrote:
> Hello,
> 
> Pinging again incase this patch missed your attention.
> 
> Thanks,
> Niteesh.
> 
> On Tue, Nov 3, 2020 at 11:49 PM G S Niteesh Babu  > wrote:
> 
> Added a basic test for the implemented RTEMS OFW
> API.
> ---
>  spec/build/testsuites/libtests/grp.yml   |   2 +
>  spec/build/testsuites/libtests/ofw01.yml |  21 +++
>  testsuites/libtests/ofw01/init.c         | 187 +++
>  testsuites/libtests/ofw01/ofw01.doc      |  29 
>  testsuites/libtests/ofw01/ofw01.scn      |   2 +
>  testsuites/libtests/ofw01/some.c         |  72 +
>  testsuites/libtests/ofw01/some.dts       |  76 +
>  testsuites/libtests/ofw01/some.h         |  15 ++
>  8 files changed, 404 insertions(+)
>  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
>  create mode 100644 testsuites/libtests/ofw01/init.c
>  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
>  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
>  create mode 100644 testsuites/libtests/ofw01/some.c
>  create mode 100644 testsuites/libtests/ofw01/some.dts
>  create mode 100644 testsuites/libtests/ofw01/some.h
> 
> diff --git a/spec/build/testsuites/libtests/grp.yml
> b/spec/build/testsuites/libtests/grp.yml
> index b9ca014b0d..1aa136854a 100644
> --- a/spec/build/testsuites/libtests/grp.yml
> +++ b/spec/build/testsuites/libtests/grp.yml
> @@ -316,6 +316,8 @@ links:
>    uid: write
>  - role: build-dependency
>    uid: writev
> +- role: build-dependency
> +  uid: ofw01
>  type: build
>  use-after:
>  - rtemstest
> diff --git a/spec/build/testsuites/libtests/ofw01.yml
> b/spec/build/testsuites/libtests/ofw01.yml
> new file mode 100644
> index 00..8517c58bad
> --- /dev/null
> +++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
> +cppflags: []
> +cxxflags: []
> +enabled-by: true
> +features: c cprogram
> +includes: []
> +ldflags:
> +- -Wl,--wrap=bsp_fdt_get
> +links: []
> +source:
> +- testsuites/libtests/ofw01/init.c
> +- testsuites/libtests/ofw01/some.c
> +stlib: []
> +target: testsuites/libtests/ofw01.exe
> +type: build
> +use-after: []
> +use-before: []
> diff --git a/testsuites/libtests/ofw01/init.c
> b/testsuites/libtests/ofw01/init.c
> new file mode 100644
> index 00..82ee5eb11f
> --- /dev/null
> +++ b/testsuites/libtests/ofw01/init.c
> @@ -0,0 +1,187 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/*
> + * Copyright (C) <2020> Niteesh G S  >
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "some.h"
> +
> +#define BUF_SIZE 100
> +
> +const char rtems_test_name[] = "OFW 01";
> +

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-08 Thread Niteesh G. S.
Hello,

Pinging again incase this patch missed your attention.

Thanks,
Niteesh.

On Tue, Nov 3, 2020 at 11:49 PM G S Niteesh Babu 
wrote:

> Added a basic test for the implemented RTEMS OFW
> API.
> ---
>  spec/build/testsuites/libtests/grp.yml   |   2 +
>  spec/build/testsuites/libtests/ofw01.yml |  21 +++
>  testsuites/libtests/ofw01/init.c | 187 +++
>  testsuites/libtests/ofw01/ofw01.doc  |  29 
>  testsuites/libtests/ofw01/ofw01.scn  |   2 +
>  testsuites/libtests/ofw01/some.c |  72 +
>  testsuites/libtests/ofw01/some.dts   |  76 +
>  testsuites/libtests/ofw01/some.h |  15 ++
>  8 files changed, 404 insertions(+)
>  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
>  create mode 100644 testsuites/libtests/ofw01/init.c
>  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
>  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
>  create mode 100644 testsuites/libtests/ofw01/some.c
>  create mode 100644 testsuites/libtests/ofw01/some.dts
>  create mode 100644 testsuites/libtests/ofw01/some.h
>
> diff --git a/spec/build/testsuites/libtests/grp.yml
> b/spec/build/testsuites/libtests/grp.yml
> index b9ca014b0d..1aa136854a 100644
> --- a/spec/build/testsuites/libtests/grp.yml
> +++ b/spec/build/testsuites/libtests/grp.yml
> @@ -316,6 +316,8 @@ links:
>uid: write
>  - role: build-dependency
>uid: writev
> +- role: build-dependency
> +  uid: ofw01
>  type: build
>  use-after:
>  - rtemstest
> diff --git a/spec/build/testsuites/libtests/ofw01.yml
> b/spec/build/testsuites/libtests/ofw01.yml
> new file mode 100644
> index 00..8517c58bad
> --- /dev/null
> +++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
> +cppflags: []
> +cxxflags: []
> +enabled-by: true
> +features: c cprogram
> +includes: []
> +ldflags:
> +- -Wl,--wrap=bsp_fdt_get
> +links: []
> +source:
> +- testsuites/libtests/ofw01/init.c
> +- testsuites/libtests/ofw01/some.c
> +stlib: []
> +target: testsuites/libtests/ofw01.exe
> +type: build
> +use-after: []
> +use-before: []
> diff --git a/testsuites/libtests/ofw01/init.c
> b/testsuites/libtests/ofw01/init.c
> new file mode 100644
> index 00..82ee5eb11f
> --- /dev/null
> +++ b/testsuites/libtests/ofw01/init.c
> @@ -0,0 +1,187 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/*
> + * Copyright (C) <2020> Niteesh G S 
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "some.h"
> +
> +#define BUF_SIZE 100
> +
> +const char rtems_test_name[] = "OFW 01";
> +
> +const void *__wrap_bsp_fdt_get(void);
> +const void *__real_bsp_fdt_get(void);
> +
> +const void *__wrap_bsp_fdt_get(void)
> +{
> +  if (some_bin != NULL) {
> +return _bin[0];
> +  }
> +
> +  return __real_bsp_fdt_get();
> +}
> +
> +static void Init(rtems_task_argument arg)
> +{
> +  int rv;
> +  phandle_t d;
> +  phandle_t l;
> +  phandle_t t;
> +  phandle_t c;
> +  phandle_t a;
> +  phandle_t b;
> +  phandle_t q;
> +  phandle_t root;
> +  phandle_t temp;
> +  uint32_t *arr;
> +  char buf[BUF_SIZE];
> +  char *bufp;
> +  ssize_t buf_len;
> +  rtems_ofw_memory_area reg;
> +  rtems_ofw_memory_area regs[2];
> +  rtems_vector_number intr;
> +  rtems_vector_number intrs[2];
> +  TEST_BEGIN();
> +  buf_len = sizeof(buf);
> +  /*
> +   * Cannot use fdt_path_offset to compare because
> +   

[PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-03 Thread G S Niteesh Babu
Added a basic test for the implemented RTEMS OFW
API.
---
 spec/build/testsuites/libtests/grp.yml   |   2 +
 spec/build/testsuites/libtests/ofw01.yml |  21 +++
 testsuites/libtests/ofw01/init.c | 187 +++
 testsuites/libtests/ofw01/ofw01.doc  |  29 
 testsuites/libtests/ofw01/ofw01.scn  |   2 +
 testsuites/libtests/ofw01/some.c |  72 +
 testsuites/libtests/ofw01/some.dts   |  76 +
 testsuites/libtests/ofw01/some.h |  15 ++
 8 files changed, 404 insertions(+)
 create mode 100644 spec/build/testsuites/libtests/ofw01.yml
 create mode 100644 testsuites/libtests/ofw01/init.c
 create mode 100644 testsuites/libtests/ofw01/ofw01.doc
 create mode 100644 testsuites/libtests/ofw01/ofw01.scn
 create mode 100644 testsuites/libtests/ofw01/some.c
 create mode 100644 testsuites/libtests/ofw01/some.dts
 create mode 100644 testsuites/libtests/ofw01/some.h

diff --git a/spec/build/testsuites/libtests/grp.yml 
b/spec/build/testsuites/libtests/grp.yml
index b9ca014b0d..1aa136854a 100644
--- a/spec/build/testsuites/libtests/grp.yml
+++ b/spec/build/testsuites/libtests/grp.yml
@@ -316,6 +316,8 @@ links:
   uid: write
 - role: build-dependency
   uid: writev
+- role: build-dependency
+  uid: ofw01
 type: build
 use-after:
 - rtemstest
diff --git a/spec/build/testsuites/libtests/ofw01.yml 
b/spec/build/testsuites/libtests/ofw01.yml
new file mode 100644
index 00..8517c58bad
--- /dev/null
+++ b/spec/build/testsuites/libtests/ofw01.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 Niteesh G S
+cppflags: []
+cxxflags: []
+enabled-by: true
+features: c cprogram
+includes: []
+ldflags:
+- -Wl,--wrap=bsp_fdt_get
+links: []
+source:
+- testsuites/libtests/ofw01/init.c
+- testsuites/libtests/ofw01/some.c
+stlib: []
+target: testsuites/libtests/ofw01.exe
+type: build
+use-after: []
+use-before: []
diff --git a/testsuites/libtests/ofw01/init.c b/testsuites/libtests/ofw01/init.c
new file mode 100644
index 00..82ee5eb11f
--- /dev/null
+++ b/testsuites/libtests/ofw01/init.c
@@ -0,0 +1,187 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) <2020> Niteesh G S 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "some.h"
+
+#define BUF_SIZE 100
+
+const char rtems_test_name[] = "OFW 01";
+
+const void *__wrap_bsp_fdt_get(void);
+const void *__real_bsp_fdt_get(void);
+
+const void *__wrap_bsp_fdt_get(void)
+{
+  if (some_bin != NULL) {
+return _bin[0];
+  }
+
+  return __real_bsp_fdt_get();
+}
+
+static void Init(rtems_task_argument arg)
+{
+  int rv;
+  phandle_t d;
+  phandle_t l;
+  phandle_t t;
+  phandle_t c;
+  phandle_t a;
+  phandle_t b;
+  phandle_t q;
+  phandle_t root;
+  phandle_t temp;
+  uint32_t *arr;
+  char buf[BUF_SIZE];
+  char *bufp;
+  ssize_t buf_len;
+  rtems_ofw_memory_area reg;
+  rtems_ofw_memory_area regs[2];
+  rtems_vector_number intr;
+  rtems_vector_number intrs[2];
+  TEST_BEGIN();
+  buf_len = sizeof(buf);
+  /*
+   * Cannot use fdt_path_offset to compare because
+   * the OF interface uses the offset from the ftdp
+   * to the node as phandle.
+   */
+  root = rtems_ofw_find_device("/");
+  rtems_test_assert(root == 56);
+
+  root = rtems_ofw_peer(0);
+  rtems_test_assert(root == 56);
+
+  d = rtems_ofw_child(root);
+  temp = rtems_ofw_find_device("/d");
+  rtems_test_assert(d == temp);
+
+  temp = rtems_ofw_parent(d);
+  rtems_test_assert(root == temp);
+
+  rv = rtems_ofw_get_prop(d, "e", buf, buf_len);
+