From: Alyssa Rosenzweig Date: Mon, 21 Dec 2020 20:20:37 +0000 (-0500) Subject: pan/bi: Stub out scheduler unit test X-Git-Tag: upstream/21.2.3~8749 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=114a0f9798636d6a476f1d6dc88c34c5ca5c4796;p=platform%2Fupstream%2Fmesa.git pan/bi: Stub out scheduler unit test Someone who understands meson and gtest could do something much nicer, but for now let's just stuff some assertions into debug builds of the standalone compiler and call it a day... Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 56bca63..7b1f2f9 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -187,3 +187,10 @@ bi_schedule(bi_context *ctx) bblock->scheduled = true; } } + +#ifndef NDEBUG +int bi_test_scheduler(void) +{ + return 0; +} +#endif diff --git a/src/panfrost/bifrost/cmdline.c b/src/panfrost/bifrost/cmdline.c index c022374..bb37c16 100644 --- a/src/panfrost/bifrost/cmdline.c +++ b/src/panfrost/bifrost/cmdline.c @@ -22,6 +22,7 @@ */ #include "disassemble.h" +#include "compiler.h" #include "main/mtypes.h" #include "compiler/glsl/standalone.h" @@ -117,6 +118,19 @@ disassemble(const char *filename, bool verbose) free(code); } +static int +bi_tests() +{ +#ifndef NDEBUG + bi_test_scheduler(); + printf("Pass.\n"); + return 0; +#else + printf("Tests omitted in release mode."); + return 1; +#endif +} + int main(int argc, char **argv) { @@ -131,6 +145,8 @@ main(int argc, char **argv) disassemble(argv[2], false); else if (strcmp(argv[1], "disasm-verbose") == 0) disassemble(argv[2], true); + else if (strcmp(argv[1], "test") == 0) + bi_tests(); else unreachable("Unknown command. Valid: compile/disasm"); diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 41e57de..94d4ee3 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -728,6 +728,9 @@ bool bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft); void bi_schedule(bi_context *ctx); void bi_register_allocate(bi_context *ctx); +/* Test suite */ +int bi_test_scheduler(void); + bi_clause * bi_singleton(void *memctx, bi_instr *ins, bi_block *block,