[Mesa-dev] [PATCH 1/2] r300g: Reorganize the compiler unit tests
Ian Romanick
idr at freedesktop.org
Mon Feb 27 09:51:02 PST 2012
On 02/25/2012 08:08 AM, Tom Stellard wrote:
If these were moved up to, say, tests/r300 at the top level and put in
'make test' I (and presumably others) would run them before pushing.
That might prevent some accidental breakages of your driver. :) If they
were (eventually) converted to the gtest framework, it would be even better.
> ---
> src/gallium/drivers/r300/compiler/tests/Makefile | 3 ++-
> .../r300/compiler/tests/r300_compiler_tests.c | 6 ++++++
> .../r300/compiler/tests/r300_compiler_tests.h | 2 ++
> .../compiler/tests/radeon_compiler_util_tests.c | 3 ++-
> 4 files changed, 12 insertions(+), 2 deletions(-)
> create mode 100644 src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
> create mode 100644 src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
>
> diff --git a/src/gallium/drivers/r300/compiler/tests/Makefile b/src/gallium/drivers/r300/compiler/tests/Makefile
> index 6eda34a..fe83e5d 100644
> --- a/src/gallium/drivers/r300/compiler/tests/Makefile
> +++ b/src/gallium/drivers/r300/compiler/tests/Makefile
> @@ -4,11 +4,12 @@ include $(TOP)/configs/current
> CFLAGS += -Wall -Werror
>
> ### Basic defines ###
> -TESTS = radeon_compiler_util_tests
> +TESTS = r300_compiler_tests
>
> TEST_SOURCES := $(TESTS:=.c)
>
> SHARED_SOURCES = \
> + radeon_compiler_util_tests.c \
> rc_test_helpers.c \
> unit_test.c
>
> diff --git a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
> new file mode 100644
> index 0000000..01495b4
> --- /dev/null
> +++ b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
> @@ -0,0 +1,6 @@
> +#include "r300_compiler_tests.h"
> +
> +int main(int argc, char ** argv)
> +{
> + radeon_compiler_util_run_tests();
> +}
> diff --git a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
> new file mode 100644
> index 0000000..0a22705
> --- /dev/null
> +++ b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
> @@ -0,0 +1,2 @@
> +
> +void radeon_compiler_util_run_tests(void);
> diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
> index a2e3f2a..5ef2596 100644
> --- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
> +++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
> @@ -5,6 +5,7 @@
> #include "radeon_compiler_util.h"
> #include "radeon_program.h"
>
> +#include "r300_compiler_tests.h"
> #include "rc_test_helpers.h"
> #include "unit_test.h"
>
> @@ -66,7 +67,7 @@ static void test_runner_rc_inst_can_use_presub(struct test_result * result)
> "MAD temp[0].xyz, temp[2].xyz_, -temp[3].xxx_, input[5].xyz_;");
> }
>
> -int main(int argc, char ** argv)
> +void radeon_compiler_util_run_tests()
> {
> struct test tests[] = {
> {"rc_inst_can_use_presub()", test_runner_rc_inst_can_use_presub},
More information about the mesa-dev
mailing list