From 0442a53fbf3adbf324afe3c3be87f3b1cf051c00 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 3 Nov 2023 18:55:02 -0700 Subject: [PATCH] Allow specifying disk directory as parameter, /dev/vdc is default path --- test/CMakeLists.txt | 4 ++-- test/layer0.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1b77761..4ff961f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ set(TARGET_LAYER0 test_layer0) - +set(DIR_PLACE /dev/vdb) # add test sources here ... add_executable(${TARGET_LAYER0} @@ -8,4 +8,4 @@ add_executable(${TARGET_LAYER0} ) # add test to activate ctest -VV -add_test(NAME ${TARGET_LAYER0} COMMAND sudo ./${TARGET_LAYER0}) \ No newline at end of file +add_test(NAME ${TARGET_LAYER0} COMMAND sudo ./${TARGET_LAYER0} ${DIR_PLACE}) \ No newline at end of file diff --git a/test/layer0.cpp b/test/layer0.cpp index 4d95e8d..1b8faeb 100644 --- a/test/layer0.cpp +++ b/test/layer0.cpp @@ -3,8 +3,14 @@ #include #include "rawdisk.h" -int main() { - char *d = strdup("/dev/vdb"); +int main(int argc, char *argv[]) { + char *d = NULL; + if(argc < 2){ + d = strdup("/dev/vdc"); + }else{ + d = argv[1]; + } + RawDisk *H = new RawDisk(d); char *buf = "iloveosdfjlseirfnerig";