diff --git a/.github/workflows/build-and-test-latest.yml b/.github/workflows/build-and-test-latest.yml index eb1c03a8..403c7f37 100644 --- a/.github/workflows/build-and-test-latest.yml +++ b/.github/workflows/build-and-test-latest.yml @@ -87,7 +87,7 @@ jobs: - name: Run Tests on QEMU timeout-minutes: 15 run: | - bash ./scripts/vm-run.sh -c "./tests" ./.cache/bzImage ./build/tests/tests 2>&1 | tee vm-run.log + bash ./scripts/vm-run.sh -c "CONDY_TEST_SSD_BASE_DIR=/mnt/ssd ./tests" ./.cache/bzImage ./build/tests/tests 2>&1 | tee vm-run.log if grep -q "SUCCESS!" vm-run.log; then echo "::notice:: All tests passed" else diff --git a/include/condy/runtime.hpp b/include/condy/runtime.hpp index 87ce301a..25b064ec 100644 --- a/include/condy/runtime.hpp +++ b/include/condy/runtime.hpp @@ -322,6 +322,11 @@ class Runtime { // No-op assert(cqe->res != -EINVAL); // If EINVAL, something is wrong } else if (type == WorkType::Notify) { + if (cqe->res == -EOPNOTSUPP) { + // Notification not supported, ignore. This may happen if we use + // eventfd for notification and iopoll is enabled. + return; + } std::lock_guard lock(mutex_); flush_global_queue_(); } else if (type == WorkType::SendFd) { diff --git a/scripts/light-kernel.sh b/scripts/light-kernel.sh index d4545261..da67ce7b 100644 --- a/scripts/light-kernel.sh +++ b/scripts/light-kernel.sh @@ -56,6 +56,12 @@ cd "$SOURCE_DIR" make defconfig # Configure kvm guest support make kvm_guest.config +# Configure NVMe support +./scripts/config --enable CONFIG_NVME_CORE +./scripts/config --enable CONFIG_BLK_DEV_NVME +./scripts/config --enable CONFIG_NVME_MULTIPATH +# Use olddefconfig to set new options to default values +make olddefconfig # Build the kernel make -j"$(nproc)" bzImage diff --git a/scripts/vm-run.sh b/scripts/vm-run.sh index 1eb15cc7..c874894d 100644 --- a/scripts/vm-run.sh +++ b/scripts/vm-run.sh @@ -73,7 +73,10 @@ trap "rm -rf $TEMP_DIR" EXIT cat > "$TEMP_DIR/init.sh" < +#include TEST_CASE("test runtime_options - event_interval") { condy::RuntimeOptions options; @@ -28,11 +29,19 @@ TEST_CASE("test runtime_options - event_interval") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_iopoll") { - char name[32] = "XXXXXX"; + const char *ssd_base_dir = std::getenv("CONDY_TEST_SSD_BASE_DIR"); + if (ssd_base_dir == nullptr) { + MESSAGE("CONDY_TEST_SSD_BASE_DIR not set, skipping"); + return; + } + std::string template_path = std::string(ssd_base_dir) + "/XXXXXX"; + char name[32]; + strncpy(name, template_path.c_str(), sizeof(name)); + name[sizeof(name) - 1] = '\0'; int fd = mkstemp(name); REQUIRE(fd >= 0); @@ -56,6 +65,8 @@ TEST_CASE("test runtime_options - enable_iopoll") { #else options.enable_iopoll(/*hybrid=*/false); #endif + // Disable periodic event peeking to exposure hang caused by eventfd+iopoll + options.event_interval(std::numeric_limits::max()); condy::Runtime runtime(options); alignas(4096) char buffer[4096]; @@ -66,7 +77,7 @@ TEST_CASE("test runtime_options - enable_iopoll") { REQUIRE(std::string_view(buffer, msg.size()) == msg); }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_sqpoll") { @@ -92,7 +103,7 @@ TEST_CASE("test runtime_options - enable_sqpoll") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_defer_taskrun") { @@ -118,7 +129,7 @@ TEST_CASE("test runtime_options - enable_defer_taskrun") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_attach_wq") { @@ -178,7 +189,7 @@ TEST_CASE("test runtime_options - enable_coop_taskrun") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_sqe128 & enable_cqe32") { @@ -204,7 +215,7 @@ TEST_CASE("test runtime_options - enable_sqe128 & enable_cqe32") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } TEST_CASE("test runtime_options - enable_no_mmap") { @@ -235,5 +246,5 @@ TEST_CASE("test runtime_options - enable_no_mmap") { } }; - condy::sync_wait(func()); + condy::sync_wait(runtime, func()); } \ No newline at end of file