mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
test: add testcases for net.ifname-policy= kernel command line argument
This commit is contained in:
parent
a4c9bf2e51
commit
79463de533
@ -49,14 +49,14 @@ static void test_netdev_one(const char *ifname, const char *key, const char *val
|
||||
assert_se(streq(output, expected));
|
||||
}
|
||||
|
||||
static void test_link_one(const char *ifname, const char *key, const char *value, const char *expected) {
|
||||
static void test_link_one(const char *filename, const char *key, const char *value, const char *expected) {
|
||||
_cleanup_(context_clear) Context context = {};
|
||||
_cleanup_free_ char *output = NULL;
|
||||
Link *link;
|
||||
|
||||
printf("# %s=%s\n", key, value);
|
||||
assert_se(parse_cmdline_item(key, value, &context) >= 0);
|
||||
assert_se(link = link_get(&context, ifname));
|
||||
assert_se(link = link_get(&context, filename));
|
||||
assert_se(link_format(link, &output) >= 0);
|
||||
puts(output);
|
||||
assert_se(streq(output, expected));
|
||||
@ -334,6 +334,22 @@ int main(int argc, char *argv[]) {
|
||||
"Name=hogehoge\n"
|
||||
);
|
||||
|
||||
test_link_one("001122334455", "net.ifname-policy", "keep,kernel,database,onboard,slot,path,mac,00:11:22:33:44:55",
|
||||
"[Match]\n"
|
||||
"MACAddress=00:11:22:33:44:55\n"
|
||||
"\n[Link]\n"
|
||||
"NamePolicy=keep kernel database onboard slot path mac\n"
|
||||
"AlternativeNamesPolicy=database onboard slot path mac\n"
|
||||
);
|
||||
|
||||
test_link_one("default", "net.ifname-policy", "keep,kernel,database,onboard,slot,path,mac",
|
||||
"[Match]\n"
|
||||
"OriginalName=*\n"
|
||||
"\n[Link]\n"
|
||||
"NamePolicy=keep kernel database onboard slot path mac\n"
|
||||
"AlternativeNamesPolicy=database onboard slot path mac\n"
|
||||
);
|
||||
|
||||
test_network_two("eth0",
|
||||
"ip", "192.168.0.10:192.168.0.2:192.168.0.1:255.255.255.0:hogehoge:eth0:on:10.10.10.10:10.10.10.11",
|
||||
"rd.route", "10.1.2.3/16:10.0.2.3",
|
||||
|
Loading…
Reference in New Issue
Block a user