diff options
author | Steve Muckle <smuckle@google.com> | 2019-12-06 17:08:09 -0800 |
---|---|---|
committer | Steve Muckle <smuckle@google.com> | 2019-12-27 13:39:23 -0800 |
commit | 373a3cadd7d0d221e1c3e1976a0fb0c6a1c34f9f (patch) | |
tree | a90243c25eed12c77d41e35b6360b34be770f36f /libmodprobe/libmodprobe_test.cpp | |
parent | ee08c978d2d34b3ddac420f9cbdc6ec65286c1e8 (diff) |
libmodprobe: parse kernel command line for module options
Bug: 145808811
Test: atest libmodprobe_tests, verify on flame
Change-Id: I0b41b1610fe13ae526d38f029da888f6f0d8a02d
Diffstat (limited to 'libmodprobe/libmodprobe_test.cpp')
-rw-r--r-- | libmodprobe/libmodprobe_test.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/libmodprobe/libmodprobe_test.cpp b/libmodprobe/libmodprobe_test.cpp index a711631da..879c7f2e9 100644 --- a/libmodprobe/libmodprobe_test.cpp +++ b/libmodprobe/libmodprobe_test.cpp @@ -31,7 +31,13 @@ std::vector<std::string> test_modules; // Used by libmodprobe_ext_test to report which modules would have been loaded. std::vector<std::string> modules_loaded; +// Used by libmodprobe_ext_test to fake a kernel commandline +std::string kernel_cmdline; + TEST(libmodprobe, Test) { + kernel_cmdline = + "flag1 flag2 test1.option1=50 test4.option3=\"set x\" test1.option2=60 " + "test8. test5.option1= test10.option1=1"; test_modules = { "/test1.ko", "/test2.ko", "/test3.ko", "/test4.ko", "/test5.ko", "/test6.ko", "/test7.ko", "/test8.ko", "/test9.ko", "/test10.ko", @@ -42,25 +48,33 @@ TEST(libmodprobe, Test) { "/test14.ko", "/test15.ko", "/test3.ko", - "/test4.ko", - "/test1.ko", + "/test4.ko option3=\"set x\"", + "/test1.ko option1=50 option2=60", "/test6.ko", "/test2.ko", - "/test5.ko", + "/test5.ko option1=", "/test8.ko", "/test7.ko param1=4", "/test9.ko param_x=1 param_y=2 param_z=3", - "/test10.ko", + "/test10.ko option1=1", "/test12.ko", "/test11.ko", "/test13.ko", }; std::vector<std::string> expected_after_remove = { - "/test14.ko", "/test15.ko", "/test1.ko", - "/test6.ko", "/test2.ko", "/test5.ko", - "/test8.ko", "/test7.ko param1=4", "/test9.ko param_x=1 param_y=2 param_z=3", - "/test10.ko", "/test12.ko", "/test11.ko", + "/test14.ko", + "/test15.ko", + "/test1.ko option1=50 option2=60", + "/test6.ko", + "/test2.ko", + "/test5.ko option1=", + "/test8.ko", + "/test7.ko param1=4", + "/test9.ko param_x=1 param_y=2 param_z=3", + "/test10.ko option1=1", + "/test12.ko", + "/test11.ko", "/test13.ko", }; |