From a5a2a406f8d65f0e852d9ed7fbfb630c6b81dd7f Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Wed, 17 Dec 2008 11:30:03 +0000
Subject: stdbuf: A new program to run a command with modified stdio buffering
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add stdbuf command to list.
* configure.ac: Only enable on ELF systems with GCC.
* cfg.mk (sc_system_h_headers): Use VC_LIST_EXCEPT rather than
VC_LIST, so we can add an exception, if needed.
* .x-sc_system_h_headers: New file. Exempt libstdbuf.c.
* Makefile.am (syntax_check_exceptions): Add .x-sc_system_h_headers.
* doc/coreutils.texi (stdbuf invocation): Add stdbuf info.
* man/.gitignore: Ignore generated manpage.
* src/.gitignore: Ignore stdbuf and libstdbuf.so binaries.
* man/Makefile.am (stdbuf.1): Add dependency.
* man/stdbuf.x: New file with example usage.
* po/POTFILES.in: Reference new command and shared library sources.
* src/Makefile.am (build_if_possible__progs): Add stdbuf and libstdbuf,
(pkglib_PROGRAMS): Reference optional shared lib,
(libstdbuf_so_LDADD): Ensure we don't link with non PIC libcoreutils.a.
(libstdbuf_so_LDFLAGS): Add -shared GCC option,
(libstdbuf_so_CFLAGS): Add -fPIC GCC option.
(check-README): Exclude libstbuf.
(check-AUTHORS): ditto.
(sc_tight_scope): Exclude functions starting with __.
* src/libstdbuf.c: The LD_PRELOAD shared library to control buffering.
* src/stdbuf.c: New file to setup env variables before execing command.
* tests/Makefile.am: Reference new test file.
* tests/misc/help-version: Set expected exit codes.
* tests/misc/invalid-opt: ditto.
* tests/misc/stdbuf: Add 9 tests.
---
tests/Makefile.am | 1 +
tests/misc/help-version | 2 ++
tests/misc/invalid-opt | 1 +
tests/misc/stdbuf | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+)
create mode 100755 tests/misc/stdbuf
(limited to 'tests')
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 24f54baef..59737a05d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -217,6 +217,7 @@ TESTS = \
misc/split-l \
misc/stat-fmt \
misc/stat-printf \
+ misc/stdbuf \
misc/stty \
misc/stty-invalid \
misc/stty-row-col \
diff --git a/tests/misc/help-version b/tests/misc/help-version
index ee7460058..983148b87 100755
--- a/tests/misc/help-version
+++ b/tests/misc/help-version
@@ -28,6 +28,7 @@ export SHELL
. $srcdir/test-lib.sh
expected_failure_status_nohup=127
+expected_failure_status_stdbuf=125
expected_failure_status_timeout=125
expected_failure_status_printenv=2
expected_failure_status_tty=3
@@ -148,6 +149,7 @@ printf_args=foo
seq_args=10
sleep_args=0
su_args=--version
+stdbuf_args="-oL true"
timeout_args=--version
# I'd rather not run sync, since it spins up disks that I've
diff --git a/tests/misc/invalid-opt b/tests/misc/invalid-opt
index cbd41cae1..9af2dd24c 100755
--- a/tests/misc/invalid-opt
+++ b/tests/misc/invalid-opt
@@ -32,6 +32,7 @@ my %exit_status =
expr => 0,
nohup => 127,
sort => 2,
+ stdbuf => 125,
test => 0,
timeout => 125,
true => 0,
diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf
new file mode 100755
index 000000000..6f79e771f
--- /dev/null
+++ b/tests/misc/stdbuf
@@ -0,0 +1,86 @@
+#!/bin/sh
+# Exercise stdbuf functionality
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see