]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/opt-chdir.mk
Merge bmake-20201117
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / opt-chdir.mk
1 # $NetBSD: opt-chdir.mk,v 1.5 2020/11/15 05:43:56 sjg Exp $
2 #
3 # Tests for the -C command line option, which changes the directory at the
4 # beginning.
5 #
6 # This option has been available since 2009-08-27.
7
8 .MAKEFLAGS: -d0                 # switch stdout to line-buffered
9
10 all: chdir-filename-too-long
11 all: chdir-root
12 all: chdir-nonexistent
13
14 # Try to overflow the internal buffer for .CURDIR, which is curdir.
15 chdir-filename-too-long: .PHONY .IGNORE
16         # 5000 slashes, separated by dots: /./././.../././
17         @${MAKE} -C ${:U:range=5000:@@/@:ts.}
18
19 # Changing to another directory is possible via the command line.
20 # In this test, it is the root directory since almost any other directory
21 # is not guaranteed to exist on every platform.
22 chdir-root: .PHONY .IGNORE
23         @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}'
24
25 # Trying to change to a nonexistent directory exits immediately.
26 chdir-nonexistent: .PHONY .IGNORE
27         @${MAKE} -C /nonexistent