Skip to content

Commit 7bbd3a7

Browse files
Andy Rossnashif
Andy Ross
authored andcommitted
tests/kernel: Add a test for CONFIG_MULTITHREADING=n
This is a feature Ben added so you could use Zephyr's arch layer to bootstrap things like bootloaders without sucking in the whole kernel. And it's worked until now. But we never had a test for it, and I just broke it with the scheduler rework. Add a trivial test just to make sure this continues to link and run. Longer term it would be nice to have some kind of size metric here to guarantee that the feature stays lean and doesn't pull in needless code. Signed-off-by: Andy Ross <[email protected]>
1 parent 3d14615 commit 7bbd3a7

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
2+
project(NONE)
3+
4+
FILE(GLOB app_sources src/*.c)
5+
target_sources(app PRIVATE ${app_sources})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_ZTEST=y
2+
CONFIG_MULTITHREADING=n
3+
CONFIG_USERSPACE=n
4+
CONFIG_BT=n
5+
CONFIG_USB=n
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2018 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include <zephyr.h>
7+
#include <ztest.h>
8+
9+
/* The only point to CONFIG_MULTITHREADING=n is to use Zephyr's
10+
* multiplatform toolchain, linkage and boostrap integration to arrive
11+
* here so the user can run C code unimpeded. In general, we don't
12+
* promise that *any* Zephyr APIs are going to work properly, so don't
13+
* try to test any. That means we can't even use the ztest suite
14+
* framework (which spawns threads internally).
15+
*/
16+
void test_main(void)
17+
{
18+
TC_PRINT("It works\n");
19+
TC_END_REPORT(TC_PASS);
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tests:
2+
kernel.threads.no-multithreading:
3+
tags: core
4+
filter: not CONFIG_SMP
5+
6+
# Pulls in GPIO by default, which needs missing APIs (why?!), but
7+
# its headers won't build with GPIO disabled.
8+
platform_exclude: galileo

0 commit comments

Comments
 (0)