From 09057aa977c18098cb266a2cb6cc0ceada2888f8 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 20 Jul 2020 08:24:31 -0600 Subject: [PATCH] fix up tests --- cmd/ifquery.c | 9 +++++++++ tests/ifquery_test | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/cmd/ifquery.c b/cmd/ifquery.c index 8e907e4..6ec858f 100644 --- a/cmd/ifquery.c +++ b/cmd/ifquery.c @@ -234,6 +234,15 @@ main(int argc, char *argv[]) for (; idx < argc; idx++) { struct lif_interface *iface = lif_state_lookup(&state, &collection, argv[idx]); + + if (iface == NULL) + { + struct lif_dict_entry *entry = lif_dict_find(&collection, argv[idx]); + + if (entry != NULL) + iface = entry->data; + } + if (iface == NULL) { fprintf(stderr, "ifquery: unknown interface %s\n", argv[idx]); diff --git a/tests/ifquery_test b/tests/ifquery_test index 6993fe6..59b5e40 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -11,12 +11,12 @@ tests_init \ dhcp_ipv4 noargs_body() { - atf_check -s exit:1 -e ignore ifquery + atf_check -s exit:1 -e ignore ifquery -S/dev/null } loopback_always_configured_body() { atf_check -s exit:0 -o match:"inet loopback" \ - ifquery -i $FIXTURES/static-eth0.interfaces lo + ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces lo } static_dual_stack_body() { @@ -24,22 +24,22 @@ static_dual_stack_body() { -o match:"address 2001:db8:1000:2::2/64" \ -o match:"gateway 203.0.113.1" \ -o match:"gateway 2001:db8:1000:2::1" \ - ifquery -i $FIXTURES/static-eth0.interfaces eth0 + ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces eth0 } static_ipv4_body() { atf_check -s exit:0 -o match:"address 203.0.113.2/24" \ -o match:"gateway 203.0.113.1" \ - ifquery -i $FIXTURES/static-eth0-v4.interfaces eth0 + ifquery -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces eth0 } static_ipv6_body() { atf_check -s exit:0 -o match:"address 2001:db8:1000:2::2/64" \ -o match:"gateway 2001:db8:1000:2::1" \ - ifquery -i $FIXTURES/static-eth0-v6.interfaces eth0 + ifquery -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces eth0 } dhcp_ipv4_body() { atf_check -s exit:0 -o match:"inet dhcp" \ - ifquery -i $FIXTURES/dhcp-eth0.interfaces eth0 + ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0 }