[Mesa-dev] [PATCH] util: cleanup ralloc_test

Kenneth Graunke kenneth at whitecape.org
Tue Aug 5 10:26:12 PDT 2014


On Tuesday, August 05, 2014 03:37:07 PM Emil Velikov wrote:
>  - Build it only once.
>  - Cleanup the CPPFLAGS.
>  - Add .gitignore.
> 
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  configure.ac                          |  2 +-
>  src/util/Makefile.am                  | 28 ++++-------------------
>  src/util/tests/Makefile.am            | 42 -----------------------------------
>  src/util/tests/ralloc/.gitignore      |  1 +
>  src/util/tests/ralloc/Makefile.am     | 37 ++++++++++++++++++++++++++++++
>  src/util/tests/ralloc/ralloc_test.cpp | 38 +++++++++++++++++++++++++++++++
>  src/util/tests/ralloc_test.cpp        | 38 -------------------------------
>  7 files changed, 81 insertions(+), 105 deletions(-)
>  delete mode 100644 src/util/tests/Makefile.am
>  create mode 100644 src/util/tests/ralloc/.gitignore
>  create mode 100644 src/util/tests/ralloc/Makefile.am
>  create mode 100644 src/util/tests/ralloc/ralloc_test.cpp
>  delete mode 100644 src/util/tests/ralloc_test.cpp
> 
> diff --git a/configure.ac b/configure.ac
> index a3b3abd..fff220d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2280,7 +2280,7 @@ AC_CONFIG_FILES([Makefile
>  		src/mesa/drivers/x11/Makefile
>  		src/mesa/main/tests/Makefile
>  		src/util/Makefile
> -		src/util/tests/Makefile
> +		src/util/tests/ralloc/Makefile
>  		src/util/tests/hash_table/Makefile])
>  
>  dnl Sort the dirs alphabetically
> diff --git a/src/util/Makefile.am b/src/util/Makefile.am
> index e738ab0..3a3a53b 100644
> --- a/src/util/Makefile.am
> +++ b/src/util/Makefile.am
> @@ -19,14 +19,10 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>  # IN THE SOFTWARE.
>  
> -SUBDIRS = . tests
> +SUBDIRS = . tests/ralloc tests/hash_table
>  
>  include Makefile.sources
>  
> -BUILT_SOURCES = $(MESA_UTIL_GENERATED_FILES)
> -
> -CLEANFILES = $(BUILT_SOURCES)
> -
>  noinst_LTLIBRARIES = libmesautil.la
>  
>  libmesautil_la_CPPFLAGS = \
> @@ -38,24 +34,8 @@ libmesautil_la_SOURCES = \
>  	$(MESA_UTIL_FILES) \
>          $(MESA_UTIL_GENERATED_FILES)
>  
> +BUILT_SOURCES = $(MESA_UTIL_GENERATED_FILES)
> +CLEANFILES = $(BUILT_SOURCES)
> +
>  format_srgb.c: $(srcdir)/format_srgb.py
>  	$(AM_V_GEN) $(PYTHON2) $< > $@
> -
> -### Tests:
> -
> -CFLAGS_FOR_TESTS = $(PTHREAD_CFLAGS)
> -CPPFLAGS_FOR_TESTS = \
> -	$(libmesautil_la_CPPFLAGS) \
> -	-I$(top_srcdir)/src/gtest/include
> -LDADD_FOR_TESTS =                               \
> -	$(top_builddir)/src/gtest/libgtest.la   \
> -	$(top_builddir)/src/util/libmesautil.la \
> -	$(PTHREAD_LIBS)
> -
> -TESTS = tests/ralloc_test
> -check_PROGRAMS = $(TESTS)
> -
> -tests_ralloc_test_SOURCES = tests/ralloc_test.cpp
> -tests_ralloc_test_CFLAGS = $(CFLAGS_FOR_TESTS)
> -tests_ralloc_test_CPPFLAGS = $(CPPFLAGS_FOR_TESTS)
> -tests_ralloc_test_LDADD = $(LDADD_FOR_TESTS)
> diff --git a/src/util/tests/Makefile.am b/src/util/tests/Makefile.am
> deleted file mode 100644
> index 8ec8c3a..0000000
> --- a/src/util/tests/Makefile.am
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -# Copyright © 2014 Intel Corporation
> -#
> -# Permission is hereby granted, free of charge, to any person obtaining a
> -# copy of this software and associated documentation files (the "Software"),
> -# to deal in the Software without restriction, including without limitation
> -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> -# and/or sell copies of the Software, and to permit persons to whom the
> -# Software is furnished to do so, subject to the following conditions:
> -#
> -# The above copyright notice and this permission notice (including the next
> -# paragraph) shall be included in all copies or substantial portions of the
> -# Software.
> -#
> -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> -# IN THE SOFTWARE.
> -
> -SUBDIRS = hash_table
> -
> -AM_CFLAGS = \
> -	$(PTHREAD_CFLAGS)
> -AM_CPPFLAGS = \
> -	-I$(top_srcdir)/include \
> -	-I$(top_srcdir)/src \
> -	-I$(top_srcdir)/src/util \
> -	-I$(top_srcdir)/src/mesa \
> -	-I$(top_srcdir)/src/gtest/include \
> -	$(DEFINES) $(INCLUDE_DIRS)
> -
> -LDADD = \
> -	$(top_builddir)/src/gtest/libgtest.la \
> -	$(top_builddir)/src/util/libmesautil.la \
> -	$(PTHREAD_LIBS)
> -
> -TESTS = ralloc_test
> -check_PROGRAMS = $(TESTS)
> -
> -ralloc_test_SOURCES = ralloc_test.cpp
> diff --git a/src/util/tests/ralloc/.gitignore b/src/util/tests/ralloc/.gitignore
> new file mode 100644
> index 0000000..9dfbb70
> --- /dev/null
> +++ b/src/util/tests/ralloc/.gitignore
> @@ -0,0 +1 @@
> +ralloc_test
> \ No newline at end of file
> diff --git a/src/util/tests/ralloc/Makefile.am b/src/util/tests/ralloc/Makefile.am
> new file mode 100644
> index 0000000..3ef3f2f
> --- /dev/null
> +++ b/src/util/tests/ralloc/Makefile.am
> @@ -0,0 +1,37 @@
> +# Copyright © 2014 Intel Corporation
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> +# IN THE SOFTWARE.
> +
> +AM_CFLAGS = \
> +	$(PTHREAD_CFLAGS)
> +AM_CPPFLAGS = \
> +	-I$(top_srcdir)/include \
> +	-I$(top_srcdir)/src/util \
> +	-I$(top_srcdir)/src/gtest/include
> +
> +LDADD = \
> +	$(top_builddir)/src/gtest/libgtest.la \
> +	$(top_builddir)/src/util/libmesautil.la \
> +	$(PTHREAD_LIBS)
> +
> +AM_DEFAULT_SOURCE_EXT = .cpp
> +
> +check_PROGRAMS = ralloc_test
> +TESTS = $(check_PROGRAMS)
> diff --git a/src/util/tests/ralloc/ralloc_test.cpp b/src/util/tests/ralloc/ralloc_test.cpp
> new file mode 100644
> index 0000000..c0a870a
> --- /dev/null
> +++ b/src/util/tests/ralloc/ralloc_test.cpp
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright © 2012 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +#include <gtest/gtest.h>
> +#include <string.h>
> +
> +#include "ralloc.h"
> +
> +/**
> + * \name Basic functionality
> + */
> +/*@{*/
> +TEST(ralloc_test, null_parent)
> +{
> +   void *mem_ctx = ralloc_context(NULL);
> +
> +   EXPECT_EQ(NULL, ralloc_parent(mem_ctx));
> +}
> +/*@}*/
> diff --git a/src/util/tests/ralloc_test.cpp b/src/util/tests/ralloc_test.cpp
> deleted file mode 100644
> index c0a870a..0000000
> --- a/src/util/tests/ralloc_test.cpp
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/*
> - * Copyright © 2012 Intel Corporation
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal in the Software without restriction, including without limitation
> - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the next
> - * paragraph) shall be included in all copies or substantial portions of the
> - * Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> - * DEALINGS IN THE SOFTWARE.
> - */
> -#include <gtest/gtest.h>
> -#include <string.h>
> -
> -#include "ralloc.h"
> -
> -/**
> - * \name Basic functionality
> - */
> -/*@{*/
> -TEST(ralloc_test, null_parent)
> -{
> -   void *mem_ctx = ralloc_context(NULL);
> -
> -   EXPECT_EQ(NULL, ralloc_parent(mem_ctx));
> -}
> -/*@}*/
> 

We could also just delete it, if you prefer - there's basically no useful testing going on here.  It was more a stub where I could add tests later...and never got around to it.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140805/e8ea0400/attachment-0001.sig>


More information about the mesa-dev mailing list