<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59599/nrf9160-ztest-framework-unable-to-get-a-unit-test-to-work</link><description>Hi. I am working on the nrf9160. I want to use a unit test framework for my application code (which is a combination of C/C++14). I thought about using gtest/gmock or ztest. For now I am trying to get to run a single sample provided: zephyr/sample/testing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Mar 2021 01:22:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59599/nrf9160-ztest-framework-unable-to-get-a-unit-test-to-work" /><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/297029?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 01:22:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:292c2d5c-557b-4722-a50f-0a1d9757f4d5</guid><dc:creator>Ian</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/emeralddragon"&gt;emeralddragon&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Were you able to get either unit test script working in the end? I&amp;#39;m currently attempting to set up unit tests and am coming across the same problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/245819?ContentTypeID=1</link><pubDate>Tue, 21 Apr 2020 11:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9e120dd-fb5d-45a8-bbb3-f4f8af25fafc</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I guess you&amp;#39;re right,&amp;nbsp;was too quick to answer. I&amp;#39;ll look into it.&lt;/p&gt;
&lt;p&gt;Have you made any progress?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/244934?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 10:33:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:602b5d19-12c0-4eca-8be8-e24b92a79258</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;Hi Simon, Not a problem. As the heading says: unable to get a unit test to work. I don&amp;#39;t see the test in the main.c being run, and my questions previously still hold.Here is a clear list of questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The sanitycheck script did run without errors on windows &lt;strong&gt;but&lt;/strong&gt; the output of that script needs some explanations. What are the 742 tests found? Why are 0 tests run etc. Please help me understand these.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Why can I not see the tests from main.c ? What am I missing?&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/244641?ContentTypeID=1</link><pubDate>Wed, 15 Apr 2020 09:30:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8642a31c-6aef-4554-ac8d-286c07701eaf</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Sorry for the delay, I&amp;#39;ve been gone due to easter holidays.&lt;/p&gt;
&lt;p&gt;Could you open a new ticket and ask your question there, since the questions are somewhat unrelated(The first question was about getting tests to work on windows and this question is asking specifically about the tests)? This way we can keep everything more organized.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/244172?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2020 11:25:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:081f6e37-d6fd-463d-b571-174ea3061afc</guid><dc:creator>Vojislav</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I am also trying to get unit testing working on nrf91, and also got to this part. I am developing on Ubuntu. What are the next steps to get tests from main.c running?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Vojislav&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/243978?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 06:58:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f62ceaf3-3a54-41ce-84ad-73b806d7fc86</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;Hi Simon. Thanks for the update. After copying the folder to zephyr/tests it seems to be working. Here is my output:&lt;/p&gt;
&lt;p&gt;INFO - JOBS: 8&lt;br /&gt;INFO - Selecting default platforms per test case&lt;br /&gt;INFO - Building initial testcase list...&lt;br /&gt;INFO - 0 test configurations selected, 163755 configurations discarded due to filters.&lt;br /&gt;INFO - Adding tasks to the queue...&lt;br /&gt;INFO - 0 of 0 tests passed (0.00%), 0 failed, 0 skipped with 0 warnings in 5.14 seconds&lt;br /&gt;INFO - In total 742 test cases were executed on 0 out of total 225 platforms (0.00%)&lt;br /&gt;scripts/dts/ path xxx/zephyr\scripts\dts&lt;br /&gt;Renaming output directory to xxx\zephyr\sanity-out.1&lt;/p&gt;
&lt;p&gt;But I am surprised that the script found 742 tests and it was not run on any platform. It says&amp;nbsp; &amp;quot;0 test configurations selected&amp;quot; and &amp;quot;0 of 0 tests passed (0.00%), 0 failed&amp;quot; How do I run the testcase from main.c and see the output?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/243224?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 14:13:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af0e75ec-f1f3-4cc8-ba2b-71c25a86f7d5</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I managed to make this work, I did the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installed ncs v1.2.0. Check out our newly released app Toolchain Manager, which simplifies the process of installing ncs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-3421898785a54c8b92fdcb92d01c7f13/pastedimage1585836785613v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Opened Git Bash&lt;/li&gt;
&lt;li&gt;Typed in:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;cd &amp;lt;location_of_ncs&amp;gt;/ncs/zephyr
export ZEPHYR_BASE=c:/Nordic_SDK/ncs/zephyr&lt;/pre&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copied the sample &lt;em&gt;..\ncs\zephyr\samples\testing\integration&amp;nbsp;&lt;/em&gt;into &lt;em&gt;..\ncs\zephyr\tests&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Ran the following command:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;python scripts/sanitycheck -s tests/integration&lt;/pre&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Got the following output:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;INFO    - JOBS: 8
INFO    - Selecting default platforms per test case
INFO    - Building initial testcase list...
INFO    - 0 test configurations selected, 163755 configurations discarded due to filters.
INFO    - Adding tasks to the queue...
INFO    - 0 of 0 tests passed (0.00%), 0 failed, 0 skipped with 0 warnings in 4.73 seconds
INFO    - In total 742 test cases were executed on 0 out of total 225 platforms (0.00%)
Renaming output directory to C:\Nordic_SDK\ncs\zephyr\sanity-out.4&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242991?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 13:47:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a1d3f2f-abea-4ced-85bf-160c9e91a23d</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;Hi SImon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I see what I got previously after adding &amp;quot;dts.&amp;quot; to the import paths.&lt;/p&gt;
&lt;p&gt;$ zephyr/scripts/sanitycheck -s ../samples/testing/integration&lt;/p&gt;
&lt;p&gt;scripts/dts/ path C:\ConnectivityNodes_Cellular\zephyr\scripts\dts&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt; File &amp;quot;zephyr/scripts/sanitycheck&amp;quot;, line 1403, in &amp;lt;module&amp;gt;&lt;br /&gt; class Platform:&lt;br /&gt; File &amp;quot;zephyr/scripts/sanitycheck&amp;quot;, line 1408, in Platform&lt;br /&gt; platform_schema = scl.yaml_load(os.path.join(ZEPHYR_BASE,&lt;br /&gt; File &amp;quot;C:\ConnectivityNode_Cellular\zephyr\scripts\sanity_chk\scl.py&amp;quot;, line 29, in yaml_load&lt;br /&gt; with open(filename, &amp;#39;r&amp;#39;) as f:&lt;br /&gt;FileNotFoundError: [Errno 2] No such file or directory: &amp;#39;C:\\ConnectivityNodes_Cellular\\zephyr\\scripts\\sanity_chk\\platform-schema.yaml&amp;#39;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242960?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 12:44:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:838d5957-5d98-4147-b48c-54bd8b2defce</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;It seems like &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/v2.1.99-ncs1/scripts/sanitycheck#L212"&gt;this line&lt;/a&gt; is the one that includes the path where &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/v2.1.99-ncs1/scripts/dts/edtlib.py"&gt;zephyr/scripts/dts/edtlib.py&lt;/a&gt;&lt;span&gt;&amp;nbsp;is located.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Have you set the ZEPHYR_BASE?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you try to add the following below this line (above import edtlib), to see what the path is equal to:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;print(&amp;quot;scripts/dts/ path&amp;quot;,os.path.join(ZEPHYR_BASE, &amp;quot;scripts&amp;quot;, &amp;quot;dts&amp;quot;))&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242953?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 12:16:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52303991-9c59-4f6b-89a8-5260e87bcf43</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;Okay. Just to mention: VB Ubuntu is not a preferred option...as of now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242929?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 11:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18647e02-4cac-4098-9215-5c0d7056d338</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I got the same error message when trying to build it in windows cmd. However, I was able to make it work using VirtualBox Ubuntu, but I&amp;#39;ll set up Cygwin and see if I am able to make it work there as well. I&amp;#39;ll keep you updated.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242837?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 06:46:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92bb28e7-0df6-470a-a05c-059337ccdf3f</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;So paths are an issue. It is unable to find the zephyr/scripts/dts path to find the edts/dts files. Any recommendations on how to fix this? I do not want to edit the zephyr source files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242827?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 05:51:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1ee0f63-b7c9-43d1-a4b0-7f833e28eca6</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;Thanks Simon. I did as you said,&amp;nbsp;&amp;nbsp;anytree, tabulate were not yet installed. But the issue remains:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;zephyr/scripts/sanitycheck -s ../samples/testing/integration&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt; File &amp;quot;zephyr/scripts/sanitycheck&amp;quot;, line 213, in &amp;lt;module&amp;gt;&lt;br /&gt; import edtlib&lt;br /&gt;ModuleNotFoundError: No module named &amp;#39;edtlib&amp;#39;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242468?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 14:16:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31dd2a05-30ff-49e7-a5e0-7ada5062c35b</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Could you test it again in Cygwin and run the following commands first:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;cd &amp;lt;sourcecode_root&amp;gt;\ncs
pip3 install -r zephyr\scripts\requirements.txt
pip3 install -r nrf\scripts\requirements.txt
pip3 install -r bootloader\mcuboot\scripts\requirements.txt&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 ztest framework : unable to get a unit test to work</title><link>https://devzone.nordicsemi.com/thread/242120?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 13:58:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6a501bc-f2a1-454a-8e63-5db24859a82e</guid><dc:creator>emeralddragon</dc:creator><description>&lt;p&gt;I have checked out master branch.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>