Package: ncurses
Version: 6.0+20161126-1
Severity: wishlist
Tags: patch

Dear Maintainer,

Please consider applying the following patch (or the original one [1])
to include support for autopkgtest to the ncurses package. This has
been part of Ubuntu since 2013 [1,2] and all tests passes for the
supported archs [3].

[1] 
http://launchpadlibrarian.net/130717116/ncurses_5.9-10ubuntu2_5.9-10ubuntu3.diff.gz
[2] https://launchpad.net/ubuntu/+source/ncurses/5.9-10ubuntu3
[3] https://autopkgtest.ubuntu.com/packages/ncurses

Many thanks,
Tiago Daitx

-- System Information:
Debian Release: stretch/sid
  APT prefers xenial-updates
  APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 
'xenial'), (400, 'xenial-proposed'), (100, 'xenial-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-34-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru ncurses-6.0+20161126/debian/changelog ncurses-6.0+20161126/debian/changelog
--- ncurses-6.0+20161126/debian/changelog	2016-11-29 18:19:08.000000000 -0200
+++ ncurses-6.0+20161126/debian/changelog	2017-03-03 22:33:14.000000000 -0300
@@ -1,3 +1,9 @@
+ncurses (6.0+20161126-2) UNRELEASED; urgency=low
+
+  * Add simple autopkgtest to the package.
+
+ -- Vibhav Pant <vibh...@ubuntu.com>  Thu, 07 Feb 2013 13:50:14 +0530
+
 ncurses (6.0+20161126-1) unstable; urgency=low
 
   * New upstream patchlevel.
diff -Nru ncurses-6.0+20161126/debian/control ncurses-6.0+20161126/debian/control
--- ncurses-6.0+20161126/debian/control	2016-11-28 15:50:38.000000000 -0200
+++ ncurses-6.0+20161126/debian/control	2016-11-30 02:13:08.000000000 -0200
@@ -13,6 +14,7 @@
 Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/ncurses.git
 Vcs-Git: https://anonscm.debian.org/git/collab-maint/ncurses.git
 Homepage: http://invisible-island.net/ncurses/
+XS-Testsuite: autopkgtest
 
 Package: libtinfo5
 Architecture: any
diff -Nru ncurses-6.0+20161126/debian/tests/build ncurses-6.0+20161126/debian/tests/build
--- ncurses-6.0+20161126/debian/tests/build	1969-12-31 21:00:00.000000000 -0300
+++ ncurses-6.0+20161126/debian/tests/build	2016-05-25 14:41:01.000000000 -0300
@@ -0,0 +1,93 @@
+#!/bin/sh
+# autopkgtest check: Build and run a program against ncurses, to verify that 
+# the headers and pkg-config file are installed correctly
+# (C) 2012 Canonical Ltd.
+# Author: Vibhav Pant <vibh...@ubuntu.com>
+
+set -e
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+cat <<EOF > curses_test.c
+#include <ncurses.h>
+#include <assert.h>
+
+/* Testing printw and friends here.
+ * Since printw expands to wprintw, it is not being tested.
+ */
+void test_printw_functions(WINDOW * win)
+{
+	int x, y;
+	assert(wprintw(win, "Printing on WINDOW win with wprintw") != ERR);
+	wrefresh(win);
+	getyx(win, y, x);
+	assert(mvwprintw
+	       (win, y + 1, x + 1,
+		"Printing on WINDOW win on coordinates %d, %d with mvwprintw\n",
+		y + 1, x + 1) != ERR);
+	wrefresh(win);
+}
+
+/* Testing wgetch */
+void test_input_functions(WINDOW * win)
+{
+	assert(wgetch(win) == 'a');
+	wrefresh(win);
+}
+
+/* Testing vwprintw */
+void test_vwprintw(WINDOW * win, char *fmt, ...)
+{
+	va_list args;
+	va_start(args, fmt);
+	assert(vwprintw(win, fmt, args) != ERR);
+	va_end(args);
+	wrefresh(win);
+}
+
+/* Testing addch and friends */
+void test_addch_functions(WINDOW * win)
+{
+	char ch;
+
+	/* Print all alphabets */
+	for (ch = 'a'; ch <= 'z'; ch++)
+		assert(waddch(win, ch) != ERR);
+	assert(waddch(win, '\n') != ERR);
+
+	wrefresh(win);
+}
+
+/* Test delwin and endwin */
+void test_delete_and_exit_functions(WINDOW * win)
+{
+	assert(delwin(win) != ERR);
+	assert(endwin() != ERR);
+}
+
+int main()
+{
+	WINDOW *win;
+
+	win = initscr();
+	if (win == NULL) {
+		fprintf(stderr, "initscr failed\n");
+		return 1;
+	}
+	test_printw_functions(win);
+	test_addch_functions(win);
+	test_input_functions(win);
+	test_vwprintw(win, "\nTesting mwvprintf\n");
+
+	return 0;
+}
+EOF
+
+gcc -o curses_test curses_test.c `pkg-config --cflags --libs ncurses` -Wall -Werror
+echo "build: OK"
+[ -x curses_test ]
+export TERM=linux
+echo a | ./curses_test
+echo "run: OK"
+
diff -Nru ncurses-6.0+20161126/debian/tests/control ncurses-6.0+20161126/debian/tests/control
--- ncurses-6.0+20161126/debian/tests/control	1969-12-31 21:00:00.000000000 -0300
+++ ncurses-6.0+20161126/debian/tests/control	2016-05-25 14:41:01.000000000 -0300
@@ -0,0 +1,2 @@
+Tests: build
+Depends: libncurses5-dev, build-essential, pkg-config

Reply via email to