From nobody Tue Apr 7 12:20:10 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93FC8313535 for ; Fri, 3 Apr 2026 15:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775230157; cv=pass; b=KCOpif47oKjZSAHLj1D4JY6pFGyp6eD8eIQkJpJF7eI+kDjwaK/Ur0DQxS8m9T9WwlXpcRnWUKNN18v4wQYTHhnG0L/IbQJCuhCRKKxoD/f8dlqaEM1kNf41coa2s0R6rCuorGISqlcn32L/V46mvc+vjSwR0eTnzXG73AN3BJc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775230157; c=relaxed/simple; bh=HWHnKr7O6oZq5C9thH7JHMNuuhNmMrYt8MJ++P38x+M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EhZQnQdhsLDQ5WHvq/bBu9nBiAXQhXOPKpkrK1q3ehaNVf8a6W13GHyo2LQdXdfMhzE6srXHXAKX0adhjzR6Kv82xoIXPUIBiaekkTvxncT0eNBC7NcRyziqu+i1qvr4Mr80c8AzA4/tfaupprQ1UtJIE7rO+3X7ri0adbd/SaQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=ka8vOp1E; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="ka8vOp1E" ARC-Seal: i=1; a=rsa-sha256; t=1775230138; cv=none; d=zohomail.eu; s=zohoarc; b=UQnaEJQ9X863u8FEOsNLce1w2tCN59/Ca/kc4RBbljB0wLVliLN1mFuAqP0sVgWzxiQAU8HNq4G7emAPXqaM4wW35drzdkMl+WkNUOmHSZi81D8Uo6Erv2rpUieh3HjVHTEt+v06dxU7bAQZk/7y4PFwzzqm609sz040jVJD8GI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1775230138; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=uPPJJd4M/dHEtYhY8xzfe2jpvGOIzrqgXsd3u0FDihs=; b=M6dRIEZMgq30nqKR0cVH6S6zQ9rByHl9Uy43aYK5jdb5qqZVwhALTx53Vq7j1x4RZO8Fr5O8HaSCqW9jDOPFQepQSn1E4CdyPORtwWz9k3zBtQtEx+JXR9Q9LLLe55skjDQ1IyazNSg2eATYzl4u/bGVpbCiqu1Ap0jLBY4Xh3o= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1775230138; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=uPPJJd4M/dHEtYhY8xzfe2jpvGOIzrqgXsd3u0FDihs=; b=ka8vOp1EjBRnAxdmbxvC1gDRgKytY99ebtCkdjTapAna0hEw2fUW2GpQ6N1jABYV DzkhUXKQRWxIRIWFXT9cKtP2w04N//WcQCrgKxlKeOoSRvu6FeLJgcjhEBYRsfvlO1z ZQLocj9peQcHW6nS0dp7nIlbkAGIUDRUTKuf6RNw= Received: by mx.zoho.eu with SMTPS id 1775230135063906.9234280012237; Fri, 3 Apr 2026 17:28:55 +0200 (CEST) From: Josh Law To: Kuan-Wei Chiu , Josh Law , David Gow , Kir Chou , Andrew Morton Cc: linux-kernel@vger.kernel.org, Steven Rostedt Subject: [PATCH] lib/glob: add more KUnit tests for glob Date: Fri, 3 Apr 2026 15:28:53 +0000 Message-Id: <20260403152853.61870-1-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Since there isnt much tests for lib/glob.c, lets go ahead and add some more= tests Signed-off-by: Josh Law --- lib/tests/glob_kunit.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/tests/glob_kunit.c b/lib/tests/glob_kunit.c index 362b1eda8e5b..73d4f72fa824 100644 --- a/lib/tests/glob_kunit.c +++ b/lib/tests/glob_kunit.c @@ -90,6 +90,31 @@ static const struct glob_test_case glob_test_cases[] =3D= { { .pat =3D "*abcd*abcdef*", .str =3D "abcabcdabcdeabcdefg", .expected =3D= true }, { .pat =3D "*abcd*", .str =3D "abcabcabcabcefg", .expected =3D false }, { .pat =3D "*ab*cd*", .str =3D "abcabcabcabcefg", .expected =3D false }, + /* backslash escaping */ + { .pat =3D "\\a", .str =3D "a", .expected =3D true }, + { .pat =3D "\\a", .str =3D "\\a", .expected =3D false }, + { .pat =3D "\\*", .str =3D "*", .expected =3D true }, + { .pat =3D "\\*", .str =3D "a", .expected =3D false }, + { .pat =3D "\\?", .str =3D "?", .expected =3D true }, + { .pat =3D "\\?", .str =3D "a", .expected =3D false }, + { .pat =3D "\\[a]", .str =3D "[a]", .expected =3D true }, + { .pat =3D "\\\\", .str =3D "\\", .expected =3D true }, + { .pat =3D "a\\*b", .str =3D "a*b", .expected =3D true }, + { .pat =3D "a\\*b", .str =3D "aXb", .expected =3D false }, + /* trailing backslash */ + { .pat =3D "a\\", .str =3D "a", .expected =3D true }, + { .pat =3D "\\", .str =3D "", .expected =3D true }, + /* backwards ranges */ + { .pat =3D "[z-a]", .str =3D "m", .expected =3D false }, + { .pat =3D "[!z-a]", .str =3D "m", .expected =3D true }, + /* high-bit characters */ + { .pat =3D "\xc0", .str =3D "\xc0", .expected =3D true }, + { .pat =3D "\xc0", .str =3D "\x80", .expected =3D false }, + { .pat =3D "[\x80-\xff]", .str =3D "\xc0", .expected =3D true }, + { .pat =3D "[\x80-\xff]", .str =3D "\x7f", .expected =3D false }, + /* unclosed bracket as literal */ + { .pat =3D "[abc", .str =3D "[abc", .expected =3D true }, + { .pat =3D "[abc", .str =3D "a", .expected =3D false }, }; =20 static void glob_case_to_desc(const struct glob_test_case *t, char *desc) --=20 2.34.1