Skip to content

Commit

Permalink
tests: test-ttyname{,_r}: ensure tested fd is tty
Browse files Browse the repository at this point in the history
Fixes:

	$ make test 2>&1 | tee logs
	(...)
	env LD_PRELOAD=/home/gportay/src/iamroot/x86_64/libiamroot-linux-x86-64.so.2:/home/gportay/src/iamroot/tests/rootfs/usr/lib64/libc.so.6:/home/gportay/src/iamroot/tests/rootfs/usr/lib64/libdl.so.2:/home/gportay/src/iamroot/tests/rootfs/usr/lib64/libpthread.so.0 PATH=/home/gportay/src/iamroot/tests/rootfs/usr/bin                                                                                            test-ttyname 1
	ttyname: Inappropriate ioctl for device
  • Loading branch information
gportay committed Mar 22, 2024
1 parent b2738fa commit d75a0bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,11 @@ endif
cd rootfs/ && env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin IAMROOT_ROOT=$(CURDIR)/rootfs test-truncate64 /tmp/file0 0
env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin test-ctermid
cd rootfs/ && env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin IAMROOT_ROOT=$(CURDIR)/rootfs test-ctermid
ifneq ($(shell tty 2>/dev/null),not a tty)
ifeq ($(shell test -t 1 && echo 1),1)
env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin test-ttyname 1
cd rootfs/ && env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin IAMROOT_ROOT=$(CURDIR)/rootfs test-ttyname 1
endif
ifeq ($(shell test -t 2 && echo 1),1)
env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin test-ttyname_r 2
cd rootfs/ && env LD_PRELOAD=$(IAMROOT_LIB) PATH=$(CURDIR)/rootfs/usr/bin IAMROOT_ROOT=$(CURDIR)/rootfs test-ttyname_r 2
endif
Expand Down

0 comments on commit d75a0bc

Please sign in to comment.