~alpine/aports

main/wayland: upgrade to 1.17 v1 PROPOSED

Drew DeVault: 1
 main/wayland: upgrade to 1.17

 2 files changed, 3 insertions(+), 312 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/661/mbox | git am -3
Learn more about email & git

[alpine-aports] [PATCH] main/wayland: upgrade to 1.17 Export this patch

---
 main/wayland/APKBUILD                    |   8 +-
 main/wayland/tests-fix-memory-leak.patch | 307 -----------------------
 2 files changed, 3 insertions(+), 312 deletions(-)
 delete mode 100644 main/wayland/tests-fix-memory-leak.patch

diff --git a/main/wayland/APKBUILD b/main/wayland/APKBUILD
index be2257758a..593e4d910c 100644
--- a/main/wayland/APKBUILD
+++ b/main/wayland/APKBUILD
@@ -2,7 +2,7 @@
# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=wayland
pkgver=1.16.0
pkgver=1.17.0
pkgrel=0
pkgdesc="A computer display server protocol"
url="http://wayland.freedesktop.org"
@@ -15,7 +15,6 @@ subpackages="$pkgname-dev $pkgname-libs-client:_libs $pkgname-libs-egl:_libs
	$pkgname-libs-cursor:_libs $pkgname-libs-server:_libs"
source="https://wayland.freedesktop.org/releases/$pkgname-$pkgver.tar.xz
	tests-ignore-debugger.patch
	tests-fix-memory-leak.patch
	"

builddir="$srcdir/$pkgname-$pkgver"
@@ -63,6 +62,5 @@ _libs() {
	mv "$pkgdir"/usr/lib/*-$name.so.* "$subpkgdir"/usr/lib
}

sha512sums="64eca2b1c0bc7913508a5499dae87e2723c712d8024acbb4c77c3c4a6c20de78c10704ae9827fd034116ca540a547aeec28c5a1e3bd382b23f85231424b0f49c  wayland-1.16.0.tar.xz
0f65a55265e9134ab08cabf67f9d1919c85c4cb6b69129e78bc6c50057cafcaf143007716a0fa73b2eb43d6b605944c320a12a36dbb5f15fcd2f5e770248c480  tests-ignore-debugger.patch
7527020c7d2b32f0a01ef0e014d999430cd24caf3648d820efeb9a35bfaed3d308f59932691de16700e8c1b91f6816fc92524d058601586ad01f64a4a07141c4  tests-fix-memory-leak.patch"
sha512sums="c5051aab5ff078b368c196ecfedb33ccd961265bb914845d7ed81de361bb86ae18299575baa6c4eceb0d82cf8b495e8293f31b51d1cbc05d84af0a199ab3f946  wayland-1.17.0.tar.xz
0f65a55265e9134ab08cabf67f9d1919c85c4cb6b69129e78bc6c50057cafcaf143007716a0fa73b2eb43d6b605944c320a12a36dbb5f15fcd2f5e770248c480  tests-ignore-debugger.patch"
diff --git a/main/wayland/tests-fix-memory-leak.patch b/main/wayland/tests-fix-memory-leak.patch
deleted file mode 100644
index 5b0018d49e..0000000000
--- a/main/wayland/tests-fix-memory-leak.patch
@@ -1,307 +0,0 @@
diff --git a/tests/sanity-test.c b/tests/sanity-test.c
index 2495a1159787de6accdebd624d85ff0c3a5202d0..98beca8da59b1ca3cbfbf0db0466a81c649505b3 100644
--- a/tests/sanity-test.c
+++ b/tests/sanity-test.c
@@ -35,7 +35,7 @@
 
 #include "test-compositor.h"
 
-extern int leak_check_enabled;
+extern int fd_leak_check_enabled;
 
 TEST(empty)
 {
@@ -83,71 +83,11 @@ FAIL_TEST(sanity_assert)
 	assert(0);
 }
 
-FAIL_TEST(sanity_malloc_direct)
-{
-	void *p;
--
-	assert(leak_check_enabled);
--
-	p = malloc(10);	/* memory leak */
-	assert(p);	/* assert that we got memory, also prevents
-			 * the malloc from getting optimized away. */
-	free(NULL);	/* NULL must not be counted */
-	test_disable_coredumps();
-}
--
-TEST(disable_leak_checks)
-{
-	volatile void *mem;
-	assert(leak_check_enabled);
-	/* normally this should be on the beginning of the test.
-	 * Here we need to be sure, that the leak checks are
-	 * turned on */
-	DISABLE_LEAK_CHECKS;
--
-	mem = malloc(16);
-	assert(mem);
-}
--
-FAIL_TEST(sanity_malloc_indirect)
-{
-	struct wl_array array;
--
-	assert(leak_check_enabled);
--
-	wl_array_init(&array);
--
-	/* call into library that calls malloc */
-	wl_array_add(&array, 14);
--
-	/* not freeing array, must leak */
--
-	test_disable_coredumps();
-}
--
-FAIL_TEST(tc_client_memory_leaks)
-{
-	struct display *d = display_create();
-	client_create_noarg(d, sanity_malloc_direct);
-	display_run(d);
-	test_disable_coredumps();
-	display_destroy(d);
-}
--
-FAIL_TEST(tc_client_memory_leaks2)
-{
-	struct display *d = display_create();
-	client_create_noarg(d, sanity_malloc_indirect);
-	display_run(d);
-	test_disable_coredumps();
-	display_destroy(d);
-}
--
 FAIL_TEST(sanity_fd_leak)
 {
 	int fd[2];
 
-	assert(leak_check_enabled);
+	assert(fd_leak_check_enabled);
 
 	/* leak 2 file descriptors */
 	if (pipe(fd) < 0)
@@ -185,7 +125,7 @@ sanity_fd_no_leak(void)
 {
 	int fd[2];
 
-	assert(leak_check_enabled);
+	assert(fd_leak_check_enabled);
 
 	/* leak 2 file descriptors */
 	if (pipe(fd) < 0)
diff --git a/tests/test-compositor.c b/tests/test-compositor.c
index 0631f6149c5cba90de15311d3a90122b06102fbc..72f63515ad70b8d5cf8c69e18d839a7cfdcfd69f 100644
--- a/tests/test-compositor.c
+++ b/tests/test-compositor.c
@@ -156,7 +156,7 @@ run_client(void (*client_main)(void *data), void *data,
 	   int wayland_sock, int client_pipe)
 {
 	char s[8];
-	int cur_alloc, cur_fds;
+	int cur_fds;
 	int can_continue = 0;
 
 	/* Wait until display signals that client can continue */
@@ -169,7 +169,6 @@ run_client(void (*client_main)(void *data), void *data,
 	snprintf(s, sizeof s, "%d", wayland_sock);
 	setenv("WAYLAND_SOCKET", s, 0);
 
-	cur_alloc = get_current_alloc_num();
 	cur_fds = count_open_fds();
 
 	client_main(data);
@@ -182,7 +181,7 @@ run_client(void (*client_main)(void *data), void *data,
 	if (!getenv("WAYLAND_SOCKET"))
 		cur_fds--;
 
-	check_leaks(cur_alloc, cur_fds);
+	check_fd_leaks(cur_fds);
 }
 
 static struct client_info *
diff --git a/tests/test-runner.c b/tests/test-runner.c
index 82a0a7b8c8ea24d1ad8aebe80030b6ca9e9d169d..1487dc48f720dbb4faab844588b5b01bdac806b2 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -44,16 +44,10 @@
 
 #include "test-runner.h"
 
-static int num_alloc;
-static void* (*sys_malloc)(size_t);
-static void (*sys_free)(void*);
-static void* (*sys_realloc)(void*, size_t);
-static void* (*sys_calloc)(size_t, size_t);
--
-/* when set to 1, check if tests are not leaking memory and opened files.
+/* when set to 1, check if tests are not leaking opened files.
  * It is turned on by default. It can be turned off by
  * WAYLAND_TEST_NO_LEAK_CHECK environment variable. */
-int leak_check_enabled;
+int fd_leak_check_enabled;
 
 /* when this var is set to 0, every call to test_set_timeout() is
  * suppressed - handy when debugging the test. Can be set by
@@ -65,40 +59,6 @@ static int is_atty = 0;
 
 extern const struct test __start_test_section, __stop_test_section;
 
-__attribute__ ((visibility("default"))) void *
-malloc(size_t size)
-{
-	num_alloc++;
-	return sys_malloc(size);
-}
--
-__attribute__ ((visibility("default"))) void
-free(void* mem)
-{
-	if (mem != NULL)
-		num_alloc--;
-	sys_free(mem);
-}
--
-__attribute__ ((visibility("default"))) void *
-realloc(void* mem, size_t size)
-{
-	if (mem == NULL)
-		num_alloc++;
-	return sys_realloc(mem, size);
-}
--
-__attribute__ ((visibility("default"))) void *
-calloc(size_t nmemb, size_t size)
-{
-	if (sys_calloc == NULL)
-		return NULL;
--
-	num_alloc++;
--
-	return sys_calloc(nmemb, size);
-}
--
 static const struct test *
 find_test(const char *name)
 {
@@ -156,25 +116,12 @@ sigalrm_handler(int signum)
 	abort();
 }
 
-int
-get_current_alloc_num(void)
-{
-	return num_alloc;
-}
--
 void
-check_leaks(int supposed_alloc, int supposed_fds)
+check_fd_leaks(int supposed_fds)
 {
 	int num_fds;
 
-	if (leak_check_enabled) {
-		if (supposed_alloc != num_alloc) {
-			fprintf(stderr, "Memory leak detected in test. "
-				"Allocated %d blocks, unfreed %d\n", num_alloc,
-				num_alloc - supposed_alloc);
-			abort();
-		}
--
+	if (fd_leak_check_enabled) {
 		num_fds = count_open_fds();
 		if (supposed_fds != num_fds) {
 			fprintf(stderr, "fd leak detected in test. "
@@ -183,14 +130,14 @@ check_leaks(int supposed_alloc, int supposed_fds)
 			abort();
 		}
 	} else {
-		fprintf(stderr, "Leak checks disabled\n");
+		fprintf(stderr, "FD leak checks disabled\n");
 	}
 }
 
 static void
 run_test(const struct test *t)
 {
-	int cur_alloc, cur_fds;
+	int cur_fds;
 	struct sigaction sa;
 
 	if (timeouts_enabled) {
@@ -200,7 +147,7 @@ run_test(const struct test *t)
 		assert(sigaction(SIGALRM, &sa, NULL) == 0);
 	}
 
-	cur_alloc = get_current_alloc_num();
+	//cur_alloc = get_current_alloc_num();
 	cur_fds = count_open_fds();
 
 	t->run();
@@ -209,7 +156,7 @@ run_test(const struct test *t)
 	if (timeouts_enabled)
 		alarm(0);
 
-	check_leaks(cur_alloc, cur_fds);
+	check_fd_leaks(cur_fds);
 
 	exit(EXIT_SUCCESS);
 }
@@ -348,20 +295,14 @@ int main(int argc, char *argv[])
 	int total, pass;
 	siginfo_t info;
 
-	/* Load system malloc, free, and realloc */
-	sys_calloc = dlsym(RTLD_NEXT, "calloc");
-	sys_realloc = dlsym(RTLD_NEXT, "realloc");
-	sys_malloc = dlsym(RTLD_NEXT, "malloc");
-	sys_free = dlsym(RTLD_NEXT, "free");
--
 	if (isatty(fileno(stderr)))
 		is_atty = 1;
 
 	if (is_debugger_attached()) {
-		leak_check_enabled = 0;
+		fd_leak_check_enabled = 0;
 		timeouts_enabled = 0;
 	} else {
-		leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK");
+		fd_leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK");
 		timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS");
 	}
 
diff --git a/tests/test-runner.h b/tests/test-runner.h
index 9c47a2b06eed8126be364ef2bf23c86bfa089c49..d0734009601e8d7462e8b837996bda01a299ef6e 100644
--- a/tests/test-runner.h
+++ b/tests/test-runner.h
@@ -63,11 +63,8 @@ count_open_fds(void);
 void
 exec_fd_leak_check(int nr_expected_fds); /* never returns */
 
-int
-get_current_alloc_num(void);
--
 void
-check_leaks(int supposed_allocs, int supposed_fds);
+check_fd_leaks(int supposed_fds);
 
 /*
  * set/reset the timeout in seconds. The timeout starts
@@ -89,10 +86,10 @@ test_sleep(unsigned int);
 void
 test_disable_coredumps(void);
 
-#define DISABLE_LEAK_CHECKS			\
-	do {					\
-		extern int leak_check_enabled;	\
-		leak_check_enabled = 0;		\
+#define DISABLE_LEAK_CHECKS				\
+	do {						\
+		extern int fd_leak_check_enabled;	\
+		fd_leak_check_enabled = 0;		\
 	} while (0);
 
 #endif
-- 
2.21.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---