From a5db4ba5cb8a4e2685ff5eb109eb43d19f7912f8 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 22 Jul 2014 04:24:35 +0300 Subject: [PATCH] Don't build ttyemu and run tty I/O test if grantpt is not available. * configure.ac (TAR_COND_GRANTPT): Define conditional depending on whether grantpt is available. * gnulib.modules: Remove grantpt. It relies upon a helper binary pt_chown which it installs and which is useless in the testsuite. * tests/Makefile.am [TAR_COND_GRANTPT]: Build ttyemu * tests/iotty.at: Skip test if ttyemu is not build. * tests/ttyemu.c (noecho): Fix error message (main): Use TIOCSCTTY if it is defined. --- configure.ac | 3 ++- gnulib.modules | 1 - tests/Makefile.am | 6 +++++- tests/iotty.at | 1 + tests/ttyemu.c | 5 +++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index d393876..d06e540 100644 --- a/configure.ac +++ b/configure.ac @@ -204,7 +204,8 @@ fi TAR_HEADERS_ATTR_XATTR_H -AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink]) +AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink grantpt]) +AM_CONDITIONAL([TAR_COND_GRANTPT], [test $ac_cv_func_grantpt = yes]) AC_CHECK_DECLS([getgrgid],,, [#include ]) AC_CHECK_DECLS([getpwuid],,, [#include ]) diff --git a/gnulib.modules b/gnulib.modules index 47371ec..0d2e76c 100644 --- a/gnulib.modules +++ b/gnulib.modules @@ -50,7 +50,6 @@ getpagesize gettext gettime gitlog-to-changelog -grantpt hash human inttostr diff --git a/tests/Makefile.am b/tests/Makefile.am index fd2def5..6684d1d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -263,7 +263,11 @@ installcheck-local: ## genfile ## ## ------------ ## -check_PROGRAMS = genfile ttyemu +check_PROGRAMS = genfile + +if TAR_COND_GRANTPT +check_PROGRAMS += ttyemu +endif genfile_SOURCES = genfile.c argcv.c argcv.h diff --git a/tests/iotty.at b/tests/iotty.at index 79589b7..7cbb178 100644 --- a/tests/iotty.at +++ b/tests/iotty.at @@ -27,6 +27,7 @@ AT_SETUP([terminal input]) AT_KEYWORDS([options iotty]) AT_TAR_CHECK([ +test -x $abs_builddir/ttyemu || AT_SKIP_TEST TAPE=- export TAPE ttyemu -t5 -i/dev/null tar -x diff --git a/tests/ttyemu.c b/tests/ttyemu.c index 9137290..27fed9a 100644 --- a/tests/ttyemu.c +++ b/tests/ttyemu.c @@ -188,7 +188,7 @@ noecho (int fd) to.c_cc[VEOF] = C_EOT; if (tcsetattr (fd, TCSAFLUSH | TCSASOFT, &to)) { - perror ("tcgetattr"); + perror ("tcsetattr"); exit (EX_ERR); } } @@ -349,8 +349,9 @@ main (int argc, char **argv) close (i); setsid (); +#ifdef TIOCSCTTY ioctl (0, TIOCSCTTY, 1); - +#endif execvp (argv[0], argv); perror (argv[0]); _exit (EX_EXEC); -- 2.45.2