From nobody Sun Apr 14 17:21:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VHcY24htKz5Gy71; Sun, 14 Apr 2024 17:21:42 +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 4VHcY24524z4Vr6; Sun, 14 Apr 2024 17:21:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713115302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IKFtyLBJl6slfd8ghEoXZ5PVunhyVjM1x5eSzmOW4qA=; b=NppOjktgYxmphdUuT5pPrcq1iGB6G0+4QnPZuUogYsPQfvqO8F1HRnOB+vaWVPh+ILjTE/ Jwidwe6zYMzxdh1PqoKBNjzC55WEpeePy9q3xTToAFKHVVkZIruEVdSp5HhEpAXZrDVj8d 7PbtKego5JyMpJAn3dwzp+utQ2Je2ynEZvRJcz30EYk8XkLcjogdFfF50gS7OX+C+iJ6lS LjQc6/7JP9m8G88gD4ccFrPN+Xwv8iNDgHRh9IqbsyUGw/qNgFZEudEc5F0YoKlep3riDo eMFJi2db1tnF/vm7vNIRVlaoJrI6B8fFRPYc8FJKS5Oo/msvjA2YuKL0JYukyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713115302; a=rsa-sha256; cv=none; b=ILhkS206KSFu4GNDHWZWFQ28EnvN2Ho0QbIBGSvEPRBqxHDt8j8sq/2jZ/PjYjvjLup+Hu h064ZUBvZUJU2REXSP24IV/1m6F05F7kmnYXKgHPLIYn6Jh3H9dNQZg44X1tl42MOuzymZ L6H/LwiIi/EF1Y1SjnKut0CwOPM0dwqngcaPqA8ahDIDuFFFVvtvENx+rsBUer1SSerQmc QL5MzZ371/68FvVgoWcTR5IKcuc1jM0Kq59PU0/9r1elCyUq9h/Y0fyafl5efl8yZLHuH0 j4OQmPjZrhYzvtNSDCyhbLXB4DpQIpmRhPev5B8qNLRT/ElLBLZj96YTgwhCUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713115302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IKFtyLBJl6slfd8ghEoXZ5PVunhyVjM1x5eSzmOW4qA=; b=q9fuq+EmTIkxchKLUAggiSA42ERV6uTiK+ZH3PrnfKkkC/WEokr0n9jcx88uYQ0otIkuzj MuwlDU7oI44ZQMCbj5c06FpV9dxTudxiehKnBuzb4rhcdf9Zcd53Q3hlM9j2guCoA7S/Pp QZvPxhmIuaX2FK0DkQI4xtZiRsrjPFtG0yYFrPH1vNj3k/BdlqUjsz15E1FQkCUFs6riWo WRRgsg0z8SjMBf6MpHNco4gBHWNy/3yq5kJtLepB9HTxQq3zgA5rEoWsXiXYGrlPVzjiB3 NzyL0J3JAUNLYg6hBCe0HFXx+k8/79UL89vZYVVaPwSSmsKIAcfUo77ZzW/UkQ== 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 4VHcY23gjNzPYY; Sun, 14 Apr 2024 17:21:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43EHLgTB064541; Sun, 14 Apr 2024 17:21:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43EHLgB6064538; Sun, 14 Apr 2024 17:21:42 GMT (envelope-from git) Date: Sun, 14 Apr 2024 17:21:42 GMT Message-Id: <202404141721.43EHLgB6064538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6655bec4e268 - main - tests/unix_stream: test that send(2) of zero bytes is successful List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6655bec4e268eeb779f5e57e5914761cf86b5f8a Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6655bec4e268eeb779f5e57e5914761cf86b5f8a commit 6655bec4e268eeb779f5e57e5914761cf86b5f8a Author: Gleb Smirnoff AuthorDate: 2024-04-14 17:19:20 +0000 Commit: Gleb Smirnoff CommitDate: 2024-04-14 17:19:20 +0000 tests/unix_stream: test that send(2) of zero bytes is successful Put this simple test into an existing file. We don't have a designated file for all unix/stream tests. There is extensive unix_seqpacket_test, but (at least right now) unix/seqpacket is not a superset of unix/stream, but a different implementation. We have one file that does one test for unix/stream - unix_socketpair_test. So rename it to unix_stream and start collecting all unix/stream tests in it. --- ObsoleteFiles.inc | 3 ++ tests/sys/kern/Makefile | 2 +- .../kern/{unix_socketpair_test.c => unix_stream.c} | 32 ++++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index e7d62afdd764..50f426085eff 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20240414: unix_socketpair_test renamed +OLD_FILES+=usr/tests/sys/kern/unix_socketpair_test + # 20240406: new clang import which bumps version from 17 to 18 OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_builtin_vars.h OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_cmath.h diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index bc42f53a2849..c5107ce8f9fe 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -50,7 +50,7 @@ ATF_TESTS_C+= unix_passfd_stream TEST_METADATA.unix_passfd_stream+= is_exclusive="true" ATF_TESTS_C+= unix_seqpacket_test TEST_METADATA.unix_seqpacket_test+= timeout="15" -ATF_TESTS_C+= unix_socketpair_test +ATF_TESTS_C+= unix_stream ATF_TESTS_C+= waitpid_nohang ATF_TESTS_C+= pdeathsig ATF_TESTS_C+= sigsys diff --git a/tests/sys/kern/unix_socketpair_test.c b/tests/sys/kern/unix_stream.c similarity index 83% rename from tests/sys/kern/unix_socketpair_test.c rename to tests/sys/kern/unix_stream.c index b994b791a2ed..d57cfad020fa 100644 --- a/tests/sys/kern/unix_socketpair_test.c +++ b/tests/sys/kern/unix_stream.c @@ -37,23 +37,30 @@ #include +static void +do_socketpair(int *sv) +{ + int s; + + s = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv); + ATF_REQUIRE_EQ(0, s); + ATF_REQUIRE(sv[0] >= 0); + ATF_REQUIRE(sv[1] >= 0); + ATF_REQUIRE(sv[0] != sv[1]); +} + /* getpeereid(3) should work with stream sockets created via socketpair(2) */ ATF_TC_WITHOUT_HEAD(getpeereid); ATF_TC_BODY(getpeereid, tc) { int sv[2]; - int s; uid_t real_euid, euid; gid_t real_egid, egid; real_euid = geteuid(); real_egid = getegid(); - s = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv); - ATF_CHECK_EQ(0, s); - ATF_CHECK(sv[0] >= 0); - ATF_CHECK(sv[1] >= 0); - ATF_CHECK(sv[0] != sv[1]); + do_socketpair(sv); ATF_REQUIRE_EQ(0, getpeereid(sv[0], &euid, &egid)); ATF_CHECK_EQ(real_euid, euid); @@ -67,10 +74,23 @@ ATF_TC_BODY(getpeereid, tc) close(sv[1]); } +/* Sending zero bytes should succeed (once regressed in aba79b0f4a3f). */ +ATF_TC_WITHOUT_HEAD(send_0); +ATF_TC_BODY(send_0, tc) +{ + int sv[2]; + + do_socketpair(sv); + ATF_REQUIRE(send(sv[0], sv, 0, 0) == 0); + close(sv[0]); + close(sv[1]); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, getpeereid); + ATF_TP_ADD_TC(tp, send_0); return atf_no_error(); }