From owner-dev-commits-src-all@freebsd.org Wed Apr 21 10:01:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 008DB5FEFD7; Wed, 21 Apr 2021 10:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQGKS6b6Cz4sxZ; Wed, 21 Apr 2021 10:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4EA92421F; Wed, 21 Apr 2021 10:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13LA1Guc092328; Wed, 21 Apr 2021 10:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13LA1G7a092327; Wed, 21 Apr 2021 10:01:16 GMT (envelope-from git) Date: Wed, 21 Apr 2021 10:01:16 GMT Message-Id: <202104211001.13LA1G7a092327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 67f2f67fc8ce - main - Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67f2f67fc8ce8484066e95dabac5af892888fca1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 10:01:17 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=67f2f67fc8ce8484066e95dabac5af892888fca1 commit 67f2f67fc8ce8484066e95dabac5af892888fca1 Author: Alex Richardson AuthorDate: 2021-04-21 09:58:34 +0000 Commit: Alex Richardson CommitDate: 2021-04-21 09:58:34 +0000 Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8 Two of these tests now pass. Looking at Jenkins to find the first commit where this behaviour changed indicates that 2fe5a79425c79f7b828acd91da66d97230925fc8 is the most likely cause. Reviewed By: melifaro Differential Revision: https://reviews.freebsd.org/D28886 --- tests/sys/net/routing/rtsock_config.h | 9 +++++++- tests/sys/net/routing/test_rtsock_l3.c | 38 +++++++++++++++++----------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/tests/sys/net/routing/rtsock_config.h b/tests/sys/net/routing/rtsock_config.h index 7d73f9e9a109..d9eccb6a19f6 100644 --- a/tests/sys/net/routing/rtsock_config.h +++ b/tests/sys/net/routing/rtsock_config.h @@ -126,8 +126,15 @@ config_setup(const atf_tc_t *tc, struct rtsock_config_options *co) inet_ntop(AF_INET6, &c->net6.sin6_addr, c->net6_str, INET6_ADDRSTRLEN); inet_ntop(AF_INET6, &c->addr6.sin6_addr, c->addr6_str, INET6_ADDRSTRLEN); + ATF_CHECK_ERRNO(0, true); + if (co->num_interfaces > 0) { - kldload("if_epair"); + if (kldload("if_epair") == -1) { + /* Any errno other than EEXIST is fatal. */ + ATF_REQUIRE_ERRNO(EEXIST, true); + /* Clear errno for the following tests. */ + errno = 0; + } ATF_REQUIRE_KERNEL_MODULE("if_epair"); c->ifnames = calloc(co->num_interfaces, sizeof(char *)); diff --git a/tests/sys/net/routing/test_rtsock_l3.c b/tests/sys/net/routing/test_rtsock_l3.c index 91816679400f..b377b6c51ef2 100644 --- a/tests/sys/net/routing/test_rtsock_l3.c +++ b/tests/sys/net/routing/test_rtsock_l3.c @@ -64,6 +64,7 @@ presetup_ipv6_iface(const atf_tc_t *tc) ret = iface_enable_ipv6(c->ifname); ATF_REQUIRE_MSG(ret == 0, "Unable to enable IPv6 on %s", c->ifname); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -79,6 +80,7 @@ presetup_ipv6(const atf_tc_t *tc) ret = iface_setup_addr(c->ifname, c->addr6_str, c->plen6); c->rtsock_fd = rtsock_setup_socket(); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -90,11 +92,13 @@ presetup_ipv4_iface(const atf_tc_t *tc) int ret; c = config_setup(tc, NULL); + ATF_REQUIRE(c != NULL); jump_vnet(c, tc); ret = iface_turn_up(c->ifname); ATF_REQUIRE_MSG(ret == 0, "Unable to turn up %s", c->ifname); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -112,6 +116,7 @@ presetup_ipv4(const atf_tc_t *tc) ATF_REQUIRE_MSG(ret == 0, "ifconfig failed"); c->rtsock_fd = rtsock_setup_socket(); + ATF_REQUIRE_ERRNO(0, true); return (c); } @@ -365,7 +370,7 @@ ATF_TC_BODY(rtm_get_v4_empty_dst_failure, tc) (struct sockaddr *)&c->mask4, NULL); rtsock_update_rtm_len(rtm); - ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen) == -1); } ATF_TC_CLEANUP(rtm_get_v4_empty_dst_failure, tc) @@ -373,19 +378,16 @@ ATF_TC_CLEANUP(rtm_get_v4_empty_dst_failure, tc) CLEANUP_AFTER_TEST; } -ATF_TC_WITH_CLEANUP(rtm_get_v4_hostbits_failure); -ATF_TC_HEAD(rtm_get_v4_hostbits_failure, tc) +ATF_TC_WITH_CLEANUP(rtm_get_v4_hostbits_success); +ATF_TC_HEAD(rtm_get_v4_hostbits_success, tc) { DESCRIBE_ROOT_TEST("Tests RTM_GET with prefix with some hosts-bits set"); } -ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) +ATF_TC_BODY(rtm_get_v4_hostbits_success, tc) { DECLARE_TEST_VARS; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); - c = presetup_ipv4(tc); /* Q the same prefix */ @@ -393,10 +395,11 @@ ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) (struct sockaddr *)&c->mask4, NULL); rtsock_update_rtm_len(rtm); - ATF_CHECK_ERRNO(ESRCH, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_REQUIRE_ERRNO(0, true); + ATF_CHECK_ERRNO(0, write(c->rtsock_fd, rtm, rtm->rtm_msglen) > 0); } -ATF_TC_CLEANUP(rtm_get_v4_hostbits_failure, tc) +ATF_TC_CLEANUP(rtm_get_v4_hostbits_success, tc) { CLEANUP_AFTER_TEST; } @@ -443,16 +446,13 @@ ATF_TC_CLEANUP(rtm_add_v4_gw_direct_success, tc) CLEANUP_AFTER_TEST; } -RTM_DECLARE_ROOT_TEST(rtm_add_v4_no_rtf_host_failure, - "Tests failure with netmask sa and RTF_HOST inconsistency"); +RTM_DECLARE_ROOT_TEST(rtm_add_v4_no_rtf_host_success, + "Tests success with netmask sa and RTF_HOST inconsistency"); -ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) +ATF_TC_BODY(rtm_add_v4_no_rtf_host_success, tc) { DECLARE_TEST_VARS; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); - c = presetup_ipv4(tc); /* Create IPv4 subnetwork with smaller prefix */ @@ -466,8 +466,8 @@ ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) rtsock_update_rtm_len(rtm); /* RTF_HOST is NOT specified, while netmask is empty */ - - ATF_CHECK_ERRNO(EINVAL, write(c->rtsock_fd, rtm, rtm->rtm_msglen)); + ATF_REQUIRE_ERRNO(0, true); + ATF_CHECK_ERRNO(0, write(c->rtsock_fd, rtm, rtm->rtm_msglen) > 0); } ATF_TC_WITH_CLEANUP(rtm_del_v4_prefix_nogw_success); @@ -1393,9 +1393,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, rtm_get_v4_exact_success); ATF_TP_ADD_TC(tp, rtm_get_v4_lpm_success); - ATF_TP_ADD_TC(tp, rtm_get_v4_hostbits_failure); + ATF_TP_ADD_TC(tp, rtm_get_v4_hostbits_success); ATF_TP_ADD_TC(tp, rtm_get_v4_empty_dst_failure); - ATF_TP_ADD_TC(tp, rtm_add_v4_no_rtf_host_failure); + ATF_TP_ADD_TC(tp, rtm_add_v4_no_rtf_host_success); ATF_TP_ADD_TC(tp, rtm_add_v4_gw_direct_success); ATF_TP_ADD_TC(tp, rtm_del_v4_prefix_nogw_success); ATF_TP_ADD_TC(tp, rtm_add_v6_gu_gw_gu_direct_success);