Skip to content

Commit

Permalink
Fix testing with read-only source directory.
Browse files Browse the repository at this point in the history
Three tests fail with a read-only source directory because they try to
write into the source directory.  None of these write into it in a way
that should actually be problematic for concurrent builds sharing the
same writable source directory, but avoiding any writing into the
source directory (from testing, or from building glibc if the source
timestamps are properly ordered) is still a good idea, as being able
to build with read-only sources helps make sure there isn't anything
that could cause problems for concurrent builds.

This patch changes the tests in question to use either /tmp or the
build directory to write their temporary files (or to test O_TMPFILE,
as applicable).

Tested for x86_64.

	* io/Makefile (tst-open-tmpfile-ARGS): New variable.
	* posix/tst-mmap-offset.c (fname): Use /tmp.
	* stdlib/tst-setcontext3.sh (tempfile): Use ${objpfx}.
  • Loading branch information
jsm28 committed Dec 15, 2017
1 parent a7e3edf commit 95511aa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2017-12-15 Joseph Myers <joseph@codesourcery.com>

* io/Makefile (tst-open-tmpfile-ARGS): New variable.
* posix/tst-mmap-offset.c (fname): Use /tmp.
* stdlib/tst-setcontext3.sh (tempfile): Use ${objpfx}.

2017-12-15 Steve Ellcey <sellcey@cavium.com>

* nscd/dbg_log.c (dbg_log): Increase msg buffer size.
Expand Down
2 changes: 2 additions & 0 deletions io/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ test-stat2-ARGS = Makefile . $(objpfx)test-stat2

tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp

tst-open-tmpfile-ARGS = --test-dir=$(objpfx)

ifeq ($(run-built-tests),yes)
$(objpfx)ftwtest.out: ftwtest-sh $(objpfx)ftwtest
$(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
Expand Down
2 changes: 1 addition & 1 deletion posix/tst-mmap-offset.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

static int fd;
static long int page_shift;
static char fname[] = "tst-mmap-offset-XXXXXX";
static char fname[] = "/tmp/tst-mmap-offset-XXXXXX";

static void
do_prepare (int argc, char **argv)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tst-setcontext3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cleanup() {
}
trap cleanup 0

tempfile=$(mktemp "tst-setcontext3.XXXXXXXXXX")
tempfile=$(mktemp "${objpfx}tst-setcontext3.XXXXXXXXXX")

# We want to run the test program and see if secontext called
# exit() and wrote out the test file we specified. If the
Expand Down

0 comments on commit 95511aa

Please sign in to comment.