X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fscripts%2Fvariables%2FINCLUDE_DIRS;h=6881292486b4620524a6345a3ba17fa79dde4a9d;hb=575596137b326da0fb261d4c19abe44c172b0cb7;hp=c9662e94bbf5a6ccb788e509fa6cbfe71ba7ef57;hpb=b11e2699c7ec42e6d2fc0f4c940f14e7c89b3974;p=platform%2Fupstream%2Fmake.git diff --git a/tests/scripts/variables/INCLUDE_DIRS b/tests/scripts/variables/INCLUDE_DIRS index c9662e9..6881292 100644 --- a/tests/scripts/variables/INCLUDE_DIRS +++ b/tests/scripts/variables/INCLUDE_DIRS @@ -8,11 +8,12 @@ use Cwd; $dir = cwd; $dir =~ s,.*/([^/]+)$,../$1,; -# Test #1: The content of .INCLUDE_DIRS depends on the platform for which -# make was built. What we know for sure is that it shouldn't be -# empty. -# -run_make_test(' +if (-d '/usr/include') { + # Test #1: The content of .INCLUDE_DIRS depends on the platform for which + # make was built. What we know for sure is that it shouldn't be + # empty. + # + run_make_test(' ifeq ($(.INCLUDE_DIRS),) $(warning .INCLUDE_DIRS is empty) endif @@ -20,9 +21,8 @@ endif .PHONY: all all:;@: ', -'', -''); - + '', ''); +} # Test #2: Make sure -I paths end up in .INCLUDE_DIRS. # @@ -32,15 +32,63 @@ $(warning dir is empty) endif ifeq ($(filter $(dir),$(.INCLUDE_DIRS)),) -$(warning .INCLUDE_DIRS does not contain $(dir)) +$(warning .INCLUDE_DIRS does not contain $(dir): $(.INCLUDE_DIRS)) endif .PHONY: all all:;@: ', -"-I$dir dir=$dir", -''); + "-I$dir dir=$dir", ''); + +# Find the default .INCLUDE_DIRS +create_file('defaultdirs.mk', "\$(info \$(.INCLUDE_DIRS))\nall:;\@:\n"); +my $cmd = subst_make_string("#MAKEPATH# -f defaultdirs.mk"); +my @dirs = `$cmd`; +my $dirs = $dirs[0]; +chomp $dirs; +unlink('defaultdirs.mk'); + +run_make_test(" +ifneq (\$(.INCLUDE_DIRS),$dirs) +\$(warning Mismatched \$(.INCLUDE_DIRS) != $dirs) +endif +all:;\@: +", + '', ''); + +# Verify that -I- disables content from .INCLUDE_DIRS + +run_make_test(q/ +ifneq ($(.INCLUDE_DIRS),) +$(warning Mismatched $(.INCLUDE_DIRS) != ) +endif +all:;@: +/, + '-I-', ''); + +# Prefix -I dirs to the front +mkdir('somedir', 0777); + +my $xdirs = $dirs ? " $dirs" : ''; +run_make_test(" +ifneq (\$(.INCLUDE_DIRS),somedir$xdirs) +\$(warning Mismatched '\$(.INCLUDE_DIRS)' != 'somedir$xdirs') +endif +all:;\@: +", + '-I somedir', ''); + +# Verify .INCLUDE_DIRS contains files after -I- + +run_make_test(q/ +ifneq ($(.INCLUDE_DIRS),somedir) +$(warning Mismatched $(.INCLUDE_DIRS) != somedir) +endif +all:;@: +/, + '-I - -I somedir', ''); +rmdir('somedir'); # This tells the test driver that the perl test script executed properly. 1;