[ell-i-developers] Re: Robot Framework Testing: Test Cases Design, Scripting and other Issues

  • From: Asif Sardar <engr.asif.sardar@xxxxxxxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Tue, 3 Jun 2014 14:08:56 +0300

In wiring_digital_pinMode.h in Runtime/stm32/cores, I changed the pinMode
declaration:

*#ifdef __cplusplus*
*extern "C"*
*#endif*
*static inline void pinMode(pin_t pin, const enum pin_mode mode) {*

I get this error:

*In file included from ../cores/arduelli/wiring_digital.h:34:0,*
*                 from ../cores/arduelli/Arduino.h:30,*
*                 from sketch.cpp:1:*
*../cores/arduelli/wiring_digital_pinMode.h:96:1: error: invalid use of
‘static’ in linkage specification*
* static inline void pinMode(pin_t pin, const enum pin_mode mode) {*

Then I changed the declaration to after some google search to avoid extern
"C" conflicting with inline:

*extern "C" {*
*        static void pinMode(pin_t pin, const enum pin_mode mode) {*
*                       ...*
*        }*
*}*

The code compiled, but the same error when running the test cases:
*AttributeError: ../libemulator.so: undefined symbol: pinMode*


On Mon, Jun 2, 2014 at 8:33 PM, Pekka Nikander <pekka.nikander@xxxxxx>
wrote:

> This is most likely the problem.  By default the emulator compiles
> everything with the C++ compiler.  Otherwise the peripheral emulation would
> not work.
>
> We can add extern "C" declarations for the C-style APIs, after which they
> should be callable with ctypes.
>
> In particular, for pinMode you can try adding extern "C" just before the
> first pinMode declaration:
>
> #ifdef __cplusplus
> extern "C"
> #endif
> static inline
> void pinMode(pin_t pin, const enum pin_mode mode) {
>
> If that works for pinMode, then it should work also for other C-style APIs.
>
> --Pekka
>
> On 2014–06–02, at 19:25 , Asif Sardar <engr.asif.sardar@xxxxxxxxxxxxxx>
> wrote:
>
> > It might be that ctypes only handles C and emulator uses also C++ code
> -> http://python-forum.org/viewtopic.php?f=6&t=404
> >
> >
> > On Mon, Jun 2, 2014 at 7:00 PM, Asif Sardar <
> engr.asif.sardar@xxxxxxxxxxxxxx> wrote:
> > The issue now is -> how to include header files in python script (I
> emailed about this to Mikko Korpela, but no response yet).
> >
> > I will take a day or two days more to write good wiki pages about whole
> of the weekend's and today's findings about setting up environment for both
> robot framework and also the runtime & emulator. So that, we don't get into
> these kind of mess again while setting up environment. Also, it will get
> recorded to wiki pages and repository etc.
> >
> > Then, for the rest of the week I will try finding solution related to
> header files in python scripts for dynamic shared libraries in C.
> >
> >
> > On Mon, Jun 2, 2014 at 6:55 PM, Asif Sardar <
> engr.asif.sardar@xxxxxxxxxxxxxx> wrote:
> > #!/opt/pym32/bin/python -> This didn't solved problem alone ... I had
> got same error ...
> >
> > But, but the actual problem was ... I was building docutils and
> robotframework with wrong python. Also, 32-bit python was not completely
> configured to 32 bit architecture ... I have made 32-bit python with
> correct 32 bit flags and many software dependencies involved (unfortunately
> this happens when manually building something from source code).
> >
> > After making and installing 32-bit python, I have installed the docutils
> and robotframework with this python. Now the python library script ctype
> module  is loading the shared library successfully. But, I still have
> errors:
> >
> >
> /home/asif/Ell-i-Working-Directory/Ell-i-Software-Testing/ELL-i-PyBot-Tests/test-scripts/
> >
> ==============================================================================
> > DigitalRead
> >
> ==============================================================================
> > Read high from pin                                                    |
> FAIL |
> > Setup failed:
> > AttributeError: ../libemulator.so: undefined symbol: pinMode
> >
> ------------------------------------------------------------------------------
> > Read low from pin                                                     |
> FAIL |
> > Setup failed:
> > AttributeError: ../libemulator.so: undefined symbol: pinMode
> >
> ------------------------------------------------------------------------------
> > DigitalRead                                                           |
> FAIL |
> > 2 critical tests, 0 passed, 2 failed
> > 2 tests total, 0 passed, 2 failed
> >
> ==============================================================================
> > Output:
>  
> /home/asif/Ell-i-Working-Directory/Ell-i-Software-Testing/ELL-i-PyBot-Tests/test-results/DigitalRead/output.xml
> > Log:
> /home/asif/Ell-i-Working-Directory/Ell-i-Software-Testing/ELL-i-PyBot-Tests/test-results/DigitalRead/log.html
> > Report:
>  
> /home/asif/Ell-i-Working-Directory/Ell-i-Software-Testing/ELL-i-PyBot-Tests/test-results/DigitalRead/report.html
> >
> >
> > On Mon, Jun 2, 2014 at 2:15 PM, Pekka Nikander <pekka.nikander@xxxxxx>
> wrote:
> >
> > On 2014–06–02, at 13:08 , Asif Sardar <engr.asif.sardar@xxxxxxxxxxxxxx>
> wrote:
> >
> > > I am using the run scripts from
> https://github.com/Ell-i/ELL-i-PyBot-Tests/blob/master/run-tests/DigitalRead.py
> >
> > In the script you explicitly ask it to run the default python:
> >
> > #!/usr/bin/python
> >
> > Change that to
> >
> > #!/opt/pym32/bin/python
> >
> > --Pekka
> >
> >
> >
> >
> > --
> > With Best Regards,
> > Asif Sardar.
> > +358 43 8265795
> >
> >
> >
> > --
> > With Best Regards,
> > Asif Sardar.
> > +358 43 8265795
> >
> >
> >
> > --
> > With Best Regards,
> > Asif Sardar.
> > +358 43 8265795
>
>


-- 



*With Best Regards,Asif Sardar.+358 43 8265795*

Other related posts: