From nobody Sat Jul 13 13:08:31 2024 X-Original-To: dev-commits-src-all@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 4WLpgM26mGz5QlwN; Sat, 13 Jul 2024 13:08:31 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLpgM1cVMz4NJQ; Sat, 13 Jul 2024 13:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720876111; 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=iaGRnsUlSswy2TbKrupE3Oyk6GBFFONV9q1MRIHT9i0=; b=krLGVtTPnVT4ScSyqMXGJc/tw12l/w1fflZ+ZlRWIi5jtu8DnY35mX2DwOUzwOf++uuS6/ 0U02AHRlcAv+qHQHLEJHKMpbILzhYk9oB3D0I2p+4RtIcFMOCEeQ6hL7lNvOBP8AJjHs29 jnSGtR0LLauTMv38xhjVDIgQ3LvAaKwU+HNgkr+MQ0NQEShpS1wxZl1dn4ynK/hE3JZSKt UC4O6DxXGs2xVeb0b8HLJJIOlWodLcMBUH/UDEpq44XYdCu2F+RF1618H50SsUMN75W2X5 LyhmdIA5guq3erX6sDNjoY9MYd8cwR2GV5fZ6TdJFXupOOOTGczoKB9AL1DFwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720876111; a=rsa-sha256; cv=none; b=ouK/6SLmrc3W4f48vIYfCTycJi2UiVjz2UgJV1fuCmt9F3mMoZhnQ9Eko2LiCa+Yr5kv6d mZCTzGdQWp5hfnSfNjmM+hKig6DYfoZl/sr5ap/moi8bv4jtT0UTNtAHAM7Dfo6rWWqQuP Ozr1tou5jmD68BzH/ydq9IneL67sJK5fr2IIPKi+9ojGw7GLgRVyYu6i7/K+32CHDd8Zf+ Gxqzlm4zf9nk4mlVtVhB/Dv73mZTJITHP+lL00mQtjh7KpG/wKWoxXlYl4SXA00IOabr1r q/Si1QSl77JgyGevtVSBvza3wYtdfvIlrxTk2P9JIj1VhvVgRJH1Xu5ZIyax4A== 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=1720876111; 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=iaGRnsUlSswy2TbKrupE3Oyk6GBFFONV9q1MRIHT9i0=; b=vi/P2YrcQvCY536uTzHNRP3mdko03X0Hjl9h3GGTIuKhB1+ATcozi7wLKLiiXgFNnCfZaD cWctXx041/xcQ+NmoBQZ+3rqtZKII8XWgp4qXvZCDusqbOaMaaVWu4Tq8cNjDgRKQsIwZ0 Fmuulpnv6FSKDpkN95G+mKfZcQJQ+4gZni1ehCFQm7gv3J1evBmN0bO8HrAgNGG7Nkinmb 3tx+5h6fwtYFzcoHB1sol+hH8x60ChcPKipwB/YfFU3p1eUBPJ8sk4Qud60TI1I/0A+TS2 YVoljnOUU27MCd4mhvXqV6t6tl5uVmP2yH2aqan1cOeSG2eZLYdK3FHf7X3Arg== 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 4WLpgM197szS7Y; Sat, 13 Jul 2024 13:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46DD8V5x016153; Sat, 13 Jul 2024 13:08:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DD8V3B016150; Sat, 13 Jul 2024 13:08:31 GMT (envelope-from git) Date: Sat, 13 Jul 2024 13:08:31 GMT Message-Id: <202407131308.46DD8V3B016150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: f0d1236f0fc9 - main - libc: Add memset test for int-to-char conversion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0d1236f0fc944165b657306a39d44fcc6aaa709 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d1236f0fc944165b657306a39d44fcc6aaa709 commit f0d1236f0fc944165b657306a39d44fcc6aaa709 Author: Strahinja Stanišić AuthorDate: 2024-07-13 12:53:07 +0000 Commit: Robert Clausecker CommitDate: 2024-07-13 13:07:49 +0000 libc: Add memset test for int-to-char conversion Test case to check if an implementation of memset correctly handles the value passed being wider than a byte Approved by: emaste Reviewed By: fuz (GSoC mentor), emaste Sponsored by: Google LLC (GSoC 2024) Differential Revision: https://reviews.freebsd.org/D45738 --- lib/libc/tests/string/Makefile | 2 ++ lib/libc/tests/string/memset_test.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index 4fce79685c0e..c71a83eede61 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -12,6 +12,7 @@ ATF_TESTS_C+= flsll_test ATF_TESTS_C+= memccpy_test ATF_TESTS_C+= memcmp_test ATF_TESTS_C+= memrchr_test +ATF_TESTS_C+= memset2_test ATF_TESTS_C+= memset_s_test ATF_TESTS_C+= strncmp_test ATF_TESTS_C+= stpncpy_test @@ -45,6 +46,7 @@ NETBSD_ATF_TESTS_C+= strpbrk_test NETBSD_ATF_TESTS_C+= strrchr_test NETBSD_ATF_TESTS_C+= swab_test +SRCS.memset2_test= memset_test.c SRCS.strcmp2_test= strcmp_test.c SRCS.strerror2_test= strerror_test.c diff --git a/lib/libc/tests/string/memset_test.c b/lib/libc/tests/string/memset_test.c new file mode 100644 index 000000000000..b898ad5af251 --- /dev/null +++ b/lib/libc/tests/string/memset_test.c @@ -0,0 +1,29 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Strahinja Stanisic + */ + +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(int_char_conv); +ATF_TC_BODY(int_char_conv, tc) +{ + char b[64]; + int c = 0xDEADBEEF; + memset(&b, c, 64); + for(int i = 0; i < 64; i++) { + assert(b[i] == (char)c); + } + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, int_char_conv); + return (atf_no_error()); +} +