Ztest skipping tests

Hi,

I am trying to set up unit tests for a new zephyr project on the nrf9160.  I don't want to run them on the device and instead want to run them from the command line.

I have a bare bones project set up that builds for the nrf9160.  For testing I created a test directory, new prj.conf, CMakeLists.txt, test main and test_ file to test a simple unit test.  I am building it with WSL for native posix with the command 

west build --board=native_posix . --pristine=always


It builds successfully and then I navigate to build/zephyr and run zephyr.exe which runs OK, but is says the one test that I added is skipped.
*** Booting Zephyr OS build v3.6.0-4011-g4041a2507d6e ***

------ TESTSUITE SUMMARY START ------

SUITE SKIP -   0.00% [addition_tests]: pass = 0, fail = 0, skip = 1, total = 1 duration = 0.000 seconds
 - SKIP - [addition_tests.test_addition] duration = 0.000 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL


  Any idea what I am doing wrong? Below are the files I added



CMakeLists.txt

cmake_minimum_required(VERSION 3.13.1)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(add_unit_tests)

target_sources(app PRIVATE src/test_main.c)
target_sources(app PRIVATE src/test_add.c)
target_sources(app PRIVATE ../src/add.c)

prj.conf

CONFIG_ZTEST=y
CONFIG_ZTEST_MOCKING=y

test_main.c

#include <zephyr/kernel.h>
#include <zephyr/ztest.h>

/* Entry point for the test suite */
void test_main(void) {
    ztest_run_all(NULL, false, 0, 0);
}

test_add.c

#include "../../src/add.h"
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>

/* Test function */
void test_addition(void) {
    zassert_equal(add(1, 1), 2, "1 + 1 should equal 2");
    zassert_equal(add(-1, 1), 0, "-1 + 1 should equal 0");
    zassert_equal(add(0, 0), 0, "0 + 0 should equal 0");
}

/* Register the test case */
ZTEST(addition_tests, test_addition) {
    test_addition();
}

/* Test suite registration */
ZTEST_SUITE(addition_tests, NULL, NULL, NULL, NULL, NULL);

add.c

#include "add.h"


/* Function to be tested */
int add(int a, int b) {
    return a + b;
}

Related