All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenz Bauer <lmb@cloudflare.com>
To: andrii@kernel.org
Cc: bpf@vger.kernel.org, kernel-team@cloudflare.com,
	Lorenz Bauer <lmb@cloudflare.com>
Subject: Some CO-RE negative testcases are buggy
Date: Tue, 20 Apr 2021 12:16:40 +0100	[thread overview]
Message-ID: <20210420111639.155580-1-lmb@cloudflare.com> (raw)

Hi Andrii,

I was looking at some CORE testcases, and noticed two problems:

* The checks for negative test cases use an incorrect CHECK(false) 
  invocation. This means negative test cases don't fail when they
  should.
* Some existence tests use incorrect file names, but the test harness
  is unable to detect this. Basically, failure to load due to a failed
  CORE relocation is not distinguished from ENOENT. I found the CHECK
  issue when investigating this problem.

I've written the patch attached below, but there are now 12 failures.
I don't understand the tests well enough to fix them, maybe you can
take a look?

Best
Lorenz

---
 .../selftests/bpf/prog_tests/core_reloc.c        | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/core_reloc.c b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
index d94dcead72e6..bd759290347c 100644
--- a/tools/testing/selftests/bpf/prog_tests/core_reloc.c
+++ b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
@@ -644,12 +644,12 @@ static struct core_reloc_test_case test_cases[] = {
 		.output_len = sizeof(struct core_reloc_existence_output),
 	},
 
-	FIELD_EXISTS_ERR_CASE(existence__err_int_sz),
-	FIELD_EXISTS_ERR_CASE(existence__err_int_type),
-	FIELD_EXISTS_ERR_CASE(existence__err_int_kind),
-	FIELD_EXISTS_ERR_CASE(existence__err_arr_kind),
-	FIELD_EXISTS_ERR_CASE(existence__err_arr_value_type),
-	FIELD_EXISTS_ERR_CASE(existence__err_struct_type),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_int_sz),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_int_type),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_int_kind),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_arr_kind),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_arr_value_type),
+	FIELD_EXISTS_ERR_CASE(existence___err_wrong_struct_type),
 
 	/* bitfield relocation checks */
 	BITFIELDS_CASE(bitfields, {
@@ -864,7 +864,7 @@ void test_core_reloc(void)
 		err = bpf_object__load_xattr(&load_attr);
 		if (err) {
 			if (!test_case->fails)
-				CHECK(false, "obj_load", "failed to load prog '%s': %d\n", probe_name, err);
+				CHECK(true, "obj_load", "failed to load prog '%s': %d\n", probe_name, err);
 			goto cleanup;
 		}
 
@@ -904,7 +904,7 @@ void test_core_reloc(void)
 		}
 
 		if (test_case->fails) {
-			CHECK(false, "obj_load_fail", "should fail to load prog '%s'\n", probe_name);
+			CHECK(true, "obj_load_fail", "should fail to load prog '%s'\n", probe_name);
 			goto cleanup;
 		}
 
-- 
2.27.0


             reply	other threads:[~2021-04-20 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 11:16 Lorenz Bauer [this message]
2021-04-20 16:50 ` Some CO-RE negative testcases are buggy Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210420111639.155580-1-lmb@cloudflare.com \
    --to=lmb@cloudflare.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@cloudflare.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.