public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools
@ 2014-10-06 16:00 Damien Lespiau
  2014-10-06 16:00 ` [PATCH i-g-t 2/2] quick_dump: Add a test to verify we can load the dynamic library Damien Lespiau
  2014-10-07 10:06 ` [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Ville Syrjälä
  0 siblings, 2 replies; 4+ messages in thread
From: Damien Lespiau @ 2014-10-06 16:00 UTC (permalink / raw)
  To: intel-gfx

Because quick-dump was only selecting a few files in lib/ and we move
stuff around and/or add new dependencies we were failing to provide the
necessary symbols to the shim library providing python bindings. And so
we had a run-time error:

Traceback (most recent call last):
  File "./tools/quick_dump/quick_dump.py", line 17, in <module>
    import chipset
  File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 28, in <module>
    _chipset = swig_import_helper()
  File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 24, in swig_import_helper
    _mod = imp.load_module('_chipset', fp, pathname, description)
  File "/usr/lib64/python3.3/imp.py", line 183, in load_module
    return load_dynamic(name, filename, file)
ImportError: /home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/_chipset.so: undefined symbol: kmstest_pipe_name

So, let's simplify maintainance and just link against the library we're
building and using elsewhere.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tools/quick_dump/Makefile.am          | 17 ++++++++---------
 tools/quick_dump/chipset_macro_wrap.c | 12 ------------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
index 89ac520..4bc5eca 100644
--- a/tools/quick_dump/Makefile.am
+++ b/tools/quick_dump/Makefile.am
@@ -6,15 +6,14 @@ dist_bin_SCRIPTS = quick_dump.py reg_access.py
 bin_SCRIPTS = chipset.py
 
 lib_LTLIBRARIES = I915ChipsetPython.la
-I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) $(PCIACCESS_LIBS)
-I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
-			       $(top_srcdir)/lib/igt_core.c  \
-			       $(top_srcdir)/lib/igt_debugfs.c  \
-			       $(top_srcdir)/lib/intel_os.c  \
-			       $(top_srcdir)/lib/intel_chipset.c  \
-			       $(top_srcdir)/lib/intel_reg_map.c  \
-			       $(top_srcdir)/lib/intel_mmio.c  \
-			       $(top_srcdir)/lib/intel_iosf.c
+I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
+I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c
+I915ChipsetPython_la_LIBADD =			\
+	$(top_srcdir)/lib/libintel_tools.la	\
+	$(PCIACCESS_LIBS)			\
+	$(DRM_LIBS)				\
+	$(CAIRO_LIBS)				\
+	$(NULL)
 
 chipset_wrap_python.c chipset.py: chipset.i
 	$(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -I/usr/include -I$(top_srcdir)/lib -o $@ $<
diff --git a/tools/quick_dump/chipset_macro_wrap.c b/tools/quick_dump/chipset_macro_wrap.c
index 8bba9f7..862281e 100644
--- a/tools/quick_dump/chipset_macro_wrap.c
+++ b/tools/quick_dump/chipset_macro_wrap.c
@@ -38,15 +38,3 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
 {
 	return pdev->device_id;
 }
-
-bool igt_check_boolean_env_var(const char *env_var, bool default_value)
-{
-	char *val;
-
-	val = getenv(env_var);
-	if (!val)
-		return default_value;
-
-	return atoi(val) != 0;
-}
-
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH i-g-t 2/2] quick_dump: Add a test to verify we can load the dynamic library
  2014-10-06 16:00 [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Damien Lespiau
@ 2014-10-06 16:00 ` Damien Lespiau
  2014-10-07 10:06 ` [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Ville Syrjälä
  1 sibling, 0 replies; 4+ messages in thread
From: Damien Lespiau @ 2014-10-06 16:00 UTC (permalink / raw)
  To: intel-gfx

quick_dump was failing to load because of a non resolved symbol in the
python binding library. Let's add a small test that makes sure we can
run ./quick_dump.py --help, ie load the python package and the shim
library.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tools/quick_dump/Makefile.am   | 2 ++
 tools/quick_dump/test-start.sh | 2 ++
 2 files changed, 4 insertions(+)
 create mode 100755 tools/quick_dump/test-start.sh

diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
index 4bc5eca..34d6d6a 100644
--- a/tools/quick_dump/Makefile.am
+++ b/tools/quick_dump/Makefile.am
@@ -27,3 +27,5 @@ EXTRA_DIST = $(QUICK_DUMP_EXTRA_DIST) \
 	      quick_dump.py \
 	      reg_access.py \
 	      chipset.i chipset.py
+
+TESTS = test-start.sh
diff --git a/tools/quick_dump/test-start.sh b/tools/quick_dump/test-start.sh
new file mode 100755
index 0000000..904503c
--- /dev/null
+++ b/tools/quick_dump/test-start.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./quick_dump.py --help
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools
  2014-10-06 16:00 [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Damien Lespiau
  2014-10-06 16:00 ` [PATCH i-g-t 2/2] quick_dump: Add a test to verify we can load the dynamic library Damien Lespiau
@ 2014-10-07 10:06 ` Ville Syrjälä
  2014-10-08  9:21   ` Damien Lespiau
  1 sibling, 1 reply; 4+ messages in thread
From: Ville Syrjälä @ 2014-10-07 10:06 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx

On Mon, Oct 06, 2014 at 05:00:24PM +0100, Damien Lespiau wrote:
> Because quick-dump was only selecting a few files in lib/ and we move
> stuff around and/or add new dependencies we were failing to provide the
> necessary symbols to the shim library providing python bindings. And so
> we had a run-time error:
> 
> Traceback (most recent call last):
>   File "./tools/quick_dump/quick_dump.py", line 17, in <module>
>     import chipset
>   File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 28, in <module>
>     _chipset = swig_import_helper()
>   File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 24, in swig_import_helper
>     _mod = imp.load_module('_chipset', fp, pathname, description)
>   File "/usr/lib64/python3.3/imp.py", line 183, in load_module
>     return load_dynamic(name, filename, file)
> ImportError: /home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/_chipset.so: undefined symbol: kmstest_pipe_name
> 
> So, let's simplify maintainance and just link against the library we're
> building and using elsewhere.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  tools/quick_dump/Makefile.am          | 17 ++++++++---------
>  tools/quick_dump/chipset_macro_wrap.c | 12 ------------
>  2 files changed, 8 insertions(+), 21 deletions(-)
> 
> diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
> index 89ac520..4bc5eca 100644
> --- a/tools/quick_dump/Makefile.am
> +++ b/tools/quick_dump/Makefile.am
> @@ -6,15 +6,14 @@ dist_bin_SCRIPTS = quick_dump.py reg_access.py
>  bin_SCRIPTS = chipset.py
>  
>  lib_LTLIBRARIES = I915ChipsetPython.la
> -I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) $(PCIACCESS_LIBS)
> -I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
> -			       $(top_srcdir)/lib/igt_core.c  \
> -			       $(top_srcdir)/lib/igt_debugfs.c  \
> -			       $(top_srcdir)/lib/intel_os.c  \
> -			       $(top_srcdir)/lib/intel_chipset.c  \
> -			       $(top_srcdir)/lib/intel_reg_map.c  \
> -			       $(top_srcdir)/lib/intel_mmio.c  \
> -			       $(top_srcdir)/lib/intel_iosf.c
> +I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
> +I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c
> +I915ChipsetPython_la_LIBADD =			\
> +	$(top_srcdir)/lib/libintel_tools.la	\

top_builddir

> +	$(PCIACCESS_LIBS)			\
> +	$(DRM_LIBS)				\
> +	$(CAIRO_LIBS)				\
> +	$(NULL)
>  
>  chipset_wrap_python.c chipset.py: chipset.i
>  	$(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -I/usr/include -I$(top_srcdir)/lib -o $@ $<
> diff --git a/tools/quick_dump/chipset_macro_wrap.c b/tools/quick_dump/chipset_macro_wrap.c
> index 8bba9f7..862281e 100644
> --- a/tools/quick_dump/chipset_macro_wrap.c
> +++ b/tools/quick_dump/chipset_macro_wrap.c
> @@ -38,15 +38,3 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
>  {
>  	return pdev->device_id;
>  }
> -
> -bool igt_check_boolean_env_var(const char *env_var, bool default_value)
> -{
> -	char *val;
> -
> -	val = getenv(env_var);
> -	if (!val)
> -		return default_value;
> -
> -	return atoi(val) != 0;
> -}
> -
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools
  2014-10-07 10:06 ` [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Ville Syrjälä
@ 2014-10-08  9:21   ` Damien Lespiau
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Lespiau @ 2014-10-08  9:21 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Tue, Oct 07, 2014 at 01:06:32PM +0300, Ville Syrjälä wrote:
> > +	$(top_srcdir)/lib/libintel_tools.la	\
> 
> top_builddir

Yes, caught it just before merging :) good eye though!

-- 
Damien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-08  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-06 16:00 [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Damien Lespiau
2014-10-06 16:00 ` [PATCH i-g-t 2/2] quick_dump: Add a test to verify we can load the dynamic library Damien Lespiau
2014-10-07 10:06 ` [PATCH i-g-t 1/2] quick-dump: Make quick dump link against libintel_tools Ville Syrjälä
2014-10-08  9:21   ` Damien Lespiau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox