Commit 3b09d27c authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Daniel Borkmann

selftests/bpf: Move test_align under test_progs

There is a much higher chance we can see the regressions if the
test is part of test_progs.
Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200515194904.229296-2-sdf@google.com
parent 5366d226
#include <asm/types.h> // SPDX-License-Identifier: GPL-2.0
#include <linux/types.h> #include <test_progs.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <linux/unistd.h>
#include <linux/filter.h>
#include <linux/bpf_perf_event.h>
#include <linux/bpf.h>
#include <bpf/bpf.h>
#include "../../../include/linux/filter.h"
#include "bpf_rlimit.h"
#include "bpf_util.h"
#define MAX_INSNS 512 #define MAX_INSNS 512
#define MAX_MATCHES 16 #define MAX_MATCHES 16
...@@ -670,51 +651,16 @@ static int do_test_single(struct bpf_align_test *test) ...@@ -670,51 +651,16 @@ static int do_test_single(struct bpf_align_test *test)
return ret; return ret;
} }
static int do_test(unsigned int from, unsigned int to) void test_align(void)
{ {
int all_pass = 0;
int all_fail = 0;
unsigned int i; unsigned int i;
for (i = from; i < to; i++) { for (i = 0; i < ARRAY_SIZE(tests); i++) {
struct bpf_align_test *test = &tests[i]; struct bpf_align_test *test = &tests[i];
int fail;
printf("Test %3d: %s ... ",
i, test->descr);
fail = do_test_single(test);
if (fail) {
all_fail++;
printf("FAIL\n");
} else {
all_pass++;
printf("PASS\n");
}
}
printf("Results: %d pass %d fail\n",
all_pass, all_fail);
return all_fail ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main(int argc, char **argv)
{
unsigned int from = 0, to = ARRAY_SIZE(tests);
if (argc == 3) { if (!test__start_subtest(test->descr))
unsigned int l = atoi(argv[argc - 2]); continue;
unsigned int u = atoi(argv[argc - 1]);
if (l < to && u < to) { CHECK_FAIL(do_test_single(test));
from = l;
to = u + 1;
}
} else if (argc == 2) {
unsigned int t = atoi(argv[argc - 1]);
if (t < to) {
from = t;
to = t + 1;
}
} }
return do_test(from, to);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment