| 1 | # $Id: testcase-xargs.kmk 2019 2008-11-02 00:21:05Z bird $ | 
|---|
| 2 | ## @file | 
|---|
| 3 | # kBuild - testcase for the xargs function. | 
|---|
| 4 | #          Requires manual inspection of the output. | 
|---|
| 5 | # | 
|---|
| 6 |  | 
|---|
| 7 | # | 
|---|
| 8 | # Copyright (c) 2007-2008 knut st. osmundsen <bird-src-spam@anduin.net> | 
|---|
| 9 | # | 
|---|
| 10 | # This file is part of kBuild. | 
|---|
| 11 | # | 
|---|
| 12 | # kBuild is free software; you can redistribute it and/or modify | 
|---|
| 13 | # it under the terms of the GNU General Public License as published by | 
|---|
| 14 | # the Free Software Foundation; either version 3 of the License, or | 
|---|
| 15 | # (at your option) any later version. | 
|---|
| 16 | # | 
|---|
| 17 | # kBuild is distributed in the hope that it will be useful, | 
|---|
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 20 | # GNU General Public License for more details. | 
|---|
| 21 | # | 
|---|
| 22 | # You should have received a copy of the GNU General Public License | 
|---|
| 23 | # along with kBuild.  If not, see <http://www.gnu.org/licenses/> | 
|---|
| 24 | # | 
|---|
| 25 | # | 
|---|
| 26 |  | 
|---|
| 27 | DEPTH = ../.. | 
|---|
| 28 | include $(PATH_KBUILD)/header.kmk | 
|---|
| 29 |  | 
|---|
| 30 | ifneq ($(not 1),) | 
|---|
| 31 | $(error The 'not' function is missing) | 
|---|
| 32 | endif | 
|---|
| 33 | ifneq ($(eq 1,1),1) | 
|---|
| 34 | $(error The 'eq' function is missing) | 
|---|
| 35 | endif | 
|---|
| 36 |  | 
|---|
| 37 |  | 
|---|
| 38 | ASSERT_TRUE  = $(if $(not $(1)),$(error failure: '$(1)' isn't true)) | 
|---|
| 39 | ASSERT_FALSE = $(if       $(1) ,$(error failure: '$(1)' isn't false)) | 
|---|
| 40 |  | 
|---|
| 41 | # 94 bytes | 
|---|
| 42 | ONEARG = abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_xxxxxxxxxxxx | 
|---|
| 43 | ITERATIONS := 0 1 2 3 4 5 6 7 8 9 | 
|---|
| 44 | ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) | 
|---|
| 45 | ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) | 
|---|
| 46 | ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) | 
|---|
| 47 | ITERATIONS := $(foreach i, 0 1 2 3 4 5 6 7 8 9,$(addprefix $(i),$(ITERATIONS))) | 
|---|
| 48 |  | 
|---|
| 49 | # add a 5 bytes sequence number and a space, then duplicate it 10000 times: | 
|---|
| 50 | #       100 bytes * 10000 = 1,000,000 bytes. | 
|---|
| 51 | REALLY_LONG := $(foreach i,$(ITERATIONS),$(i)$(ONEARG)) | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 | #$(call ASSERT_TRUE, $(xargs $(ECHO) 1:, $(ECHO) 2:, $(ECHO) 3:, asdf asdf asdf asdf asdf asdf asdf adf asdf asdf)) | 
|---|
| 55 |  | 
|---|
| 56 | all_recursive: | 
|---|
| 57 | $(xargs @$(ECHO_EXT) 1:, @$(ECHO_EXT) 2:, @$(ECHO_EXT) 3:, $(REALLY_LONG)) | 
|---|
| 58 | $(ECHO) done | 
|---|
| 59 |  | 
|---|