Forum Replies Created
-
AuthorPosts
-
Jose CazarinParticipant
Thanks, that would help a lot. I’ll keep in touch.
Jose CazarinParticipantGetting back to this, what we are trying to do is: we have a .txt file with the inputs of an algorithm. We want to run this algorithm in our device and check if the results are the same. The problem is: this .txt file is too big, if we try to compile it within the embedded code we run out of memory. So we are trying to find a way to, during runtime, transfer the inputs from the PC to the embedded device and still use the GoogleTest framework
We will start looking into it again and try to make the parameterized tests work. But I don’t know if that’s the solution for what we need.
Jose CazarinParticipantThank you, actually I thought about the ifdef solution a while after I posted it here, and it worked. Thank you!
Jose CazarinParticipantYes, I can create a test project that works out of the box.
I fixed the compilation errors by adding all the folders inside the C:\Users\user\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler folder, had to tweak them a bit, add some includes, and then it compiled
Then, I saw your last post, rolled back all these changes and just enabled the profiler/semihosting and checked the box that says “this project contains unit tests” and it compiled!
Then, I created a simple test file with some dummy test cases, and it worked!
Just a quick question, is there any way to select which main function is running? Because I need to 2 mains, the one where my application really is and the one to run the tests.
I’m commenting out the real main to be able to run the tests, it’s a band-aid fix but I’m wondering if there’s a better way to do that
Thank you so much for your help so far!
Jose CazarinParticipantI’ve upgraded to the custom edition of the VisualGDB
What’s the best approach to adding unit tests to an existing project?
What I tried: opening the VisualGDB properties of my current project and checking the box “this project contains unit tests based on” and selecting TinyEmbedded on the “Unit Tests” tab
But when I do this, my project doesn’t compile anymore, it throws an error saying that it can’t find the SysprogsProfilerInterface.h header being included by the SysprogsTestHooks.cpp file
But this file is present in the C:\Users\user\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler folder
I’ve tried to add the path to it manually in the Include Directories but after this the error is
Error undefined reference to `SysprogsProfiler_WriteData’
Looks like something is still missing in the configuration
Jose CazarinParticipantRight, now I realized that I got the Embedded version, thats why I was having problems. Thanks for you help
Jose CazarinParticipantI don’t have the submenu “Unit Tests” on my “VisualGDB Project Properties” windows. See SS attached. Should it be there?
When I put the nrf5x.props file that you attached in my project it builds fine!
But the Test Explorer is not finding any tests, it just outputs “No tests found to run.”
At least the example tests in the $(ProjectName)Tests should have run right?
Attachments:
You must be logged in to view attached files.Jose CazarinParticipantOk, I attached the project for you to take a look
Kind regards!
- This reply was modified 5 years ago by Jose Cazarin.
Attachments:
You must be logged in to view attached files.Jose CazarinParticipantThe problem was really affecting the build.
Thanks for the answer. So, actually I’m using an NRF microcontroller. But I was able to find the headers, and I just included the path to them in the “Include Directories” field in the “VisualGDB Project Properties” and now they are found! But I think it should work out of the box.
But looks like the project wasn’t finding the .c files. So, I added the whole
<h5>”%LOCALAPPDATA%\VisualGDB\TestFrameworks\com.sysprogs.unittest.tinyembtest“</h5>
folder to my project. And now the problem is:
<h5>\Local\VisualGDB\TestFrameworks\com.sysprogs.unittest.tinyembtest\SysprogsTestHooks.cpp(87,5): error : ‘pthread_mutex_t’ does not name a type; did you mean ‘pthread_atfork’?
1> pthread_mutex_t m_Mutex;</h5>
Looks like it’s not finding the pthread-related files. I even added the <pthread.h> header to the SysprogsTestHooks.cpp file (and the it is being found), but still got the same problem.Can you help me with this? Maybe it is something related to Windows since pthread.h is Unix-related
Thanks!
-
AuthorPosts