Mesa (master): intel/devinfo: add basic sanity tests on device database

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 19 15:56:41 UTC 2019


Module: Mesa
Branch: master
Commit: 84e70556fbd4ed4d00067f732ea177f29e4a2ec1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=84e70556fbd4ed4d00067f732ea177f29e4a2ec1

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Thu Apr 11 12:12:38 2019 +0100

intel/devinfo: add basic sanity tests on device database

v2: #undef NDEBUG (Eric)
    Use inc_include & inc_src (Eric)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Anuj Phogat anuj.phogat at gmail.com

---

 src/intel/dev/gen_device_info_test.c | 33 +++++++++++++++++++++++++++++++++
 src/intel/dev/meson.build            | 12 ++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/src/intel/dev/gen_device_info_test.c b/src/intel/dev/gen_device_info_test.c
new file mode 100644
index 00000000000..6d7d279f98c
--- /dev/null
+++ b/src/intel/dev/gen_device_info_test.c
@@ -0,0 +1,33 @@
+#undef NDEBUG
+
+#include <stdint.h>
+#include <assert.h>
+
+#include "gen_device_info.h"
+
+int
+main(int argc, char *argv[])
+{
+   struct {
+      uint32_t pci_id;
+      const char *name;
+   } chipsets[] = {
+#undef CHIPSET
+#define CHIPSET(id, family, str_name) { .pci_id = id, .name = str_name, },
+#include "pci_ids/i965_pci_ids.h"
+   };
+
+   for (uint32_t i = 0; i < ARRAY_SIZE(chipsets); i++) {
+      struct gen_device_info devinfo = { 0, };
+
+      assert(gen_get_device_info(chipsets[i].pci_id, &devinfo));
+
+      assert(devinfo.gen != 0);
+      assert(devinfo.urb.size != 0);
+      assert(devinfo.num_eu_per_subslice != 0);
+      assert(devinfo.num_thread_per_eu != 0);
+      assert(devinfo.timestamp_frequency != 0);
+   }
+
+   return 0;
+}
diff --git a/src/intel/dev/meson.build b/src/intel/dev/meson.build
index 9027a3ef2b3..0d8543b6b1c 100644
--- a/src/intel/dev/meson.build
+++ b/src/intel/dev/meson.build
@@ -33,3 +33,15 @@ libintel_dev = static_library(
   include_directories : [inc_common, inc_intel, inc_include],
   c_args : [c_vis_args, no_override_init_args],
 )
+
+if with_tests
+  test('gen_device_info_test',
+       executable(
+         'gen_device_info_test',
+         'gen_device_info_test.c',
+         include_directories : [inc_include, inc_src],
+         link_with : libintel_dev,
+       ),
+       suite : ['intel'],
+      )
+endif




More information about the mesa-commit mailing list