Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chainloader.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
overlays ? [
(import ./overlay.nix {
inherit withCcache;
smp = false; # No SMP for chainloader
})
],
pkgs ? import nixpkgs {
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ withCcache ? false, # Enable ccache. Requires correct permissions, see overlay.nix.

smp ? false, # Enable multcore support (SMP)
nixpkgs ? ./pinned.nix,
overlays ? [
(import ./overlay.nix { inherit withCcache; } )
(import ./overlay.nix { inherit withCcache; inherit smp; } )
],
pkgs ? import nixpkgs { config = {}; inherit overlays; }
}:
Expand Down
5 changes: 4 additions & 1 deletion overlay.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
withCcache, # Enable ccache. Requires correct permissions, see below.
smp, # Enable multicore support (SMP)
} :
final: prev: {

Expand Down Expand Up @@ -154,7 +155,9 @@ final: prev: {
else
[ "-DARCH=x86_64"];

cmakeFlags = archFlags;
smpFlags = if smp then [ "-DSMP=ON" ] else [];

cmakeFlags = archFlags ++ smpFlags;

# Add some pasthroughs, for easily building the depdencies (for debugging):
# $ nix-build -A NAME
Expand Down
5 changes: 4 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
# Enable ccache support. See overlay.nix for details.
withCcache ? false,

# Enable multicore suport.
smp ? false,

nixpkgs ? ./pinned.nix,
overlays ? [ (import ./overlay.nix { inherit withCcache; }) ],
overlays ? [ (import ./overlay.nix { inherit withCcache; inherit smp; }) ],
chainloader ? (import ./chainloader.nix { inherit withCcache; }),
pkgs ? import nixpkgs {
config = {};
Expand Down
28 changes: 20 additions & 8 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

: "${QUICK_SMOKE:=}" # Define this to only do a ~1-5 min. smoke test.
: "${DRY_RUN:=}" # Define this to expand all steps without running any
: "${CCACHE_FLAG:=}" # Define as "--arg withCcache true" to enable ccache.

steps=0
fails=0
Expand All @@ -32,6 +33,7 @@ fail(){
}

run(){
steps=$((steps + 1))
echo ""
echo "🚧 Step $steps) $2"
echo "⚙️ Running this command:"
Expand All @@ -41,7 +43,6 @@ run(){
declare -f $1 | sed '1d;2d;$d' | sed 's/^[[:space:]]*//' # Print the function body
echo "-------------------------------------- 💣 --------------------------------------"

steps=$((steps + 1))

if [ ! $DRY_RUN ]
then
Expand All @@ -62,18 +63,27 @@ unittests(){
}

build_chainloader(){
nix-build chainloader.nix
nix-build $CCACHE_FLAG chainloader.nix
}

build_example(){
nix-build example.nix
nix-build $CCACHE_FLAG example.nix
}

multicore_subset(){
nix-shell --pure --arg smp true $CCACHE_FLAG --argstr unikernel ./test/kernel/integration/smp --run ./test.py

# The following tests are not using multiple CPU's, but have been equippedd with some anyway
# to make sure core functionality is not broken by missing locks etc. when waking up more cores.
nix-shell --pure --arg smp true $CCACHE_FLAG --argstr unikernel ./test/net/integration/udp --run ./test.py
nix-shell --pure --arg smp true $CCACHE_FLAG --argstr unikernel ./test/kernel/integration/paging --run ./test.py
}

smoke_tests(){
nix-shell --pure --argstr unikernel ./test/net/integration/udp --run ./test.py
nix-shell --pure --argstr unikernel ./test/net/integration/tcp --run ./test.py
nix-shell --pure --argstr unikernel ./test/kernel/integration/paging --run ./test.py
nix-shell --pure --argstr unikernel ./test/kernel/integration/smp --run ./test.py
nix-shell --pure $CCACHE_FLAG --argstr unikernel ./test/net/integration/udp --run ./test.py
nix-shell --pure $CCACHE_FLAG --argstr unikernel ./test/net/integration/tcp --run ./test.py
nix-shell --pure $CCACHE_FLAG --argstr unikernel ./test/kernel/integration/paging --run ./test.py
nix-shell --pure $CCACHE_FLAG --argstr unikernel ./test/kernel/integration/smp --run ./test.py
}

run unittests "Build and run unit tests"
Expand All @@ -82,6 +92,8 @@ run build_chainloader "Build the 32-bit chainloader"

run build_example "Build the basic example"

run multicore_subset "Run selected tests with multicore enabled"

if [ "$QUICK_SMOKE" ]; then

run smoke_tests "Build and run a few key smoke tests"
Expand Down Expand Up @@ -139,7 +151,7 @@ run_testsuite() {


# The command to run, as string to be able to print the fully expanded command
cmd="nix-shell --pure --argstr unikernel $subfolder --run ./test.py"
cmd="nix-shell --pure $CCACHE_FLAG --argstr unikernel $subfolder --run ./test.py"

echo ""
echo "🚧 Step $steps.$substeps"
Expand Down
3 changes: 2 additions & 1 deletion test/kernel/integration/paging/vm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"description" : "Page protection test",
"mem" : 3584,
"time_sensitive": "True"
"time_sensitive": "True",
"smp" : 16
}
2 changes: 1 addition & 1 deletion test/net/integration/udp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(os)

os_add_executable(net_udp "UDP test" service.cpp)

os_add_drivers(net_udp virtionet ip4_reassembly)
os_add_drivers(net_udp virtionet ip4_reassembly boot_logger)
os_add_stdout(net_udp default_stdout)

configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR})
3 changes: 2 additions & 1 deletion test/net/integration/udp/vm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}],
"mem" : 400,
"time_sensitive": "True"
"time_sensitive": "True",
"smp" : 16
}
1 change: 1 addition & 0 deletions test/stl/integration/exceptions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ set(SOURCES

os_add_executable(stl_exceptions "C++ exceptions test" ${SOURCES})
os_add_stdout(stl_exceptions default_stdout)
os_add_drivers(stl_exceptions boot_logger)
configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR})
3 changes: 3 additions & 0 deletions test/stl/integration/exceptions/vm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"smp" : 16
}