Skip to content

Commit

Permalink
selftests/bpf: Convert test_bpffs to ASSERT macros
Browse files Browse the repository at this point in the history
Remove usage of deprecated CHECK macros.

Signed-off-by: Lorenz Bauer <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
lmb authored and borkmann committed Nov 3, 2021
1 parent 3871cb8 commit 9fc23c2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tools/testing/selftests/bpf/prog_tests/test_bpffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,43 @@ static int read_iter(char *file)

static int fn(void)
{
int err, duration = 0;
int err;

err = unshare(CLONE_NEWNS);
if (CHECK(err, "unshare", "failed: %d\n", errno))
if (!ASSERT_OK(err, "unshare"))
goto out;

err = mount("", "/", "", MS_REC | MS_PRIVATE, NULL);
if (CHECK(err, "mount /", "failed: %d\n", errno))
if (!ASSERT_OK(err, "mount /"))
goto out;

err = umount(TDIR);
if (CHECK(err, "umount " TDIR, "failed: %d\n", errno))
if (!ASSERT_OK(err, "umount " TDIR))
goto out;

err = mount("none", TDIR, "tmpfs", 0, NULL);
if (CHECK(err, "mount", "mount root failed: %d\n", errno))
if (!ASSERT_OK(err, "mount tmpfs"))
goto out;

err = mkdir(TDIR "/fs1", 0777);
if (CHECK(err, "mkdir "TDIR"/fs1", "failed: %d\n", errno))
if (!ASSERT_OK(err, "mkdir " TDIR "/fs1"))
goto out;
err = mkdir(TDIR "/fs2", 0777);
if (CHECK(err, "mkdir "TDIR"/fs2", "failed: %d\n", errno))
if (!ASSERT_OK(err, "mkdir " TDIR "/fs2"))
goto out;

err = mount("bpf", TDIR "/fs1", "bpf", 0, NULL);
if (CHECK(err, "mount bpffs "TDIR"/fs1", "failed: %d\n", errno))
if (!ASSERT_OK(err, "mount bpffs " TDIR "/fs1"))
goto out;
err = mount("bpf", TDIR "/fs2", "bpf", 0, NULL);
if (CHECK(err, "mount bpffs " TDIR "/fs2", "failed: %d\n", errno))
if (!ASSERT_OK(err, "mount bpffs " TDIR "/fs2"))
goto out;

err = read_iter(TDIR "/fs1/maps.debug");
if (CHECK(err, "reading " TDIR "/fs1/maps.debug", "failed\n"))
if (!ASSERT_OK(err, "reading " TDIR "/fs1/maps.debug"))
goto out;
err = read_iter(TDIR "/fs2/progs.debug");
if (CHECK(err, "reading " TDIR "/fs2/progs.debug", "failed\n"))
if (!ASSERT_OK(err, "reading " TDIR "/fs2/progs.debug"))
goto out;
out:
umount(TDIR "/fs1");
Expand Down

0 comments on commit 9fc23c2

Please sign in to comment.