[igt-dev] [UNTESTED RFC] tests: drop openssl dependency in favor of glib sha1 implementation
Jani Nikula
jani.nikula at intel.com
Tue Jan 22 12:59:40 UTC 2019
We already depend on glib which has sha1, so we don't really need
openssl just for sha1.
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Tomi Valkeinen <tomi.valkeinen at ti.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
Untested.
---
configure.ac | 1 -
lib/meson.build | 1 -
meson.build | 1 -
tests/Makefile.am | 4 +--
tests/i915/gem_userptr_blits.c | 51 +++++++++++++++++++++-------------
5 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/configure.ac b/configure.ac
index 73064fb92b30..e169d6675e3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,7 +121,6 @@ PKG_CHECK_MODULES(KMOD, [libkmod])
PKG_CHECK_MODULES(PROCPS, [libprocps])
PKG_CHECK_MODULES(LIBUNWIND, [libunwind])
PKG_CHECK_MODULES(LIBDW, [libdw])
-PKG_CHECK_MODULES(SSL, [openssl])
PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
if test x$have_valgrind = xyes; then
diff --git a/lib/meson.build b/lib/meson.build
index a3b24ea05fa3..dd36f818033c 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -67,7 +67,6 @@ lib_deps = [
pixman,
pthreads,
realtime,
- ssl,
zlib
]
diff --git a/meson.build b/meson.build
index 469723dc4633..b17e67ef7f05 100644
--- a/meson.build
+++ b/meson.build
@@ -149,7 +149,6 @@ endif
build_info += 'With libunwind: ' + libunwindinfo
libdw = dependency('libdw', required : true)
-ssl = dependency('openssl', required : true)
pixman = dependency('pixman-1', required : true)
valgrind = null_dep
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 48d77535b6bd..803a48615676 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -133,8 +133,8 @@ gem_tiled_swapping_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
gem_tiled_swapping_LDADD = $(LDADD) -lpthread
prime_self_import_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
prime_self_import_LDADD = $(LDADD) -lpthread
-gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) $(SSL_CFLAGS)
-gem_userptr_blits_LDADD = $(LDADD) $(SSL_LIBS) -lpthread
+gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
+gem_userptr_blits_LDADD = $(LDADD) -lpthread
perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
gem_eio_LDADD = $(LDADD) -lrt
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 99049267fcaf..8f8ddf43accf 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -47,7 +47,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/mman.h>
-#include <openssl/sha.h>
+#include <glib.h>
#include <signal.h>
#include <pthread.h>
#include <time.h>
@@ -1069,7 +1069,6 @@ static void store_dword_rand(int i915, unsigned int engine,
static void test_readonly(int i915)
{
- unsigned char orig[SHA_DIGEST_LENGTH];
uint64_t aperture_size;
uint32_t whandle, rhandle;
size_t sz, total;
@@ -1140,39 +1139,47 @@ static void test_readonly(int i915)
/* Now enforce read-only henceforth */
igt_assert(mprotect(space, total, PROT_READ) == 0);
- SHA1(pages, sz, orig);
igt_fork(child, 1) {
unsigned int engine;
+ char *orig;
+
+ orig = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
gem_userptr(i915, space, total, true, userptr_flags, &rhandle);
for_each_engine(i915, engine) {
- unsigned char ref[SHA_DIGEST_LENGTH];
- unsigned char result[SHA_DIGEST_LENGTH];
+ char *ref, *result;
/* First tweak the backing store through the write */
store_dword_rand(i915, engine, whandle, sz, 1024);
gem_sync(i915, whandle);
- SHA1(pages, sz, ref);
+ ref = g_compute_checksum_for_data(G_CHECKSUM_SHA1,
+ pages, sz);
/* Check some writes did land */
- igt_assert(memcmp(ref, orig, sizeof(ref)));
- memcpy(orig, ref, sizeof(orig));
+ igt_assert(strcmp(ref, orig));
/* Now try the same through the read-only handle */
store_dword_rand(i915, engine, rhandle, total, 1024);
gem_sync(i915, rhandle);
- SHA1(pages, sz, result);
+ result = g_compute_checksum_for_data(G_CHECKSUM_SHA1,
+ pages, sz);
/*
* As the writes into the read-only GPU bo should fail,
* the SHA1 hash of the backing store should be
* unaffected.
*/
- igt_assert(memcmp(ref, result, SHA_DIGEST_LENGTH) == 0);
+ igt_assert(strcmp(ref, result) == 0);
+
+ g_free(result);
+ g_free(orig);
+ orig = ref;
}
gem_close(i915, rhandle);
+
+ g_free(orig);
}
igt_waitchildren();
@@ -1189,8 +1196,7 @@ static void sigjmp_handler(int sig)
static void test_readonly_mmap(int i915)
{
- unsigned char original[SHA_DIGEST_LENGTH];
- unsigned char result[SHA_DIGEST_LENGTH];
+ char *original, *result;
uint32_t handle;
uint32_t sz;
void *pages;
@@ -1216,7 +1222,7 @@ static void test_readonly_mmap(int i915)
memset(pages, 0xa5, sz);
igt_clflush_range(pages, sz);
- SHA1(pages, sz, original);
+ original = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
ptr = __gem_mmap__gtt(i915, handle, sz, PROT_WRITE);
igt_assert(ptr == NULL);
@@ -1249,16 +1255,18 @@ static void test_readonly_mmap(int i915)
/* Double check that the kernel did indeed not let any writes through */
igt_clflush_range(pages, sz);
- SHA1(pages, sz, result);
- igt_assert(!memcmp(original, result, sizeof(original)));
+ result = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
+ igt_assert(!strcmp(original, result));
+
+ g_free(original);
+ g_free(result);
munmap(pages, sz);
}
static void test_readonly_pwrite(int i915)
{
- unsigned char original[SHA_DIGEST_LENGTH];
- unsigned char result[SHA_DIGEST_LENGTH];
+ char *original, *result;
uint32_t handle;
uint32_t sz;
void *pages;
@@ -1277,7 +1285,7 @@ static void test_readonly_pwrite(int i915)
igt_require(__gem_userptr(i915, pages, sz, true, userptr_flags, &handle) == 0);
memset(pages, 0xa5, sz);
- SHA1(pages, sz, original);
+ original = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
for (int page = 0; page < 16; page++) {
char data[4096];
@@ -1288,8 +1296,11 @@ static void test_readonly_pwrite(int i915)
gem_close(i915, handle);
- SHA1(pages, sz, result);
- igt_assert(!memcmp(original, result, sizeof(original)));
+ result = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
+ igt_assert(!strcmp(original, result));
+
+ g_free(original);
+ g_free(result);
munmap(pages, sz);
}
--
2.20.1
More information about the igt-dev
mailing list