1*cdcce7d4Sjmmv# $NetBSD: t_mkdep.sh,v 1.4 2012/08/26 22:37:19 jmmv Exp $ 23fa42f38Snjoly# 33fa42f38Snjoly# Copyright (c) 2011 The NetBSD Foundation, Inc. 43fa42f38Snjoly# All rights reserved. 53fa42f38Snjoly# 63fa42f38Snjoly# This code is derived from software contributed to The NetBSD Foundation 73fa42f38Snjoly# by Nicolas Joly. 83fa42f38Snjoly# 93fa42f38Snjoly# Redistribution and use in source and binary forms, with or without 103fa42f38Snjoly# modification, are permitted provided that the following conditions 113fa42f38Snjoly# are met: 123fa42f38Snjoly# 1. Redistributions of source code must retain the above copyright 133fa42f38Snjoly# notice, this list of conditions and the following disclaimer. 143fa42f38Snjoly# 2. Redistributions in binary form must reproduce the above copyright 153fa42f38Snjoly# notice, this list of conditions and the following disclaimer in the 163fa42f38Snjoly# documentation and/or other materials provided with the distribution. 173fa42f38Snjoly# 183fa42f38Snjoly# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 193fa42f38Snjoly# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 203fa42f38Snjoly# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 213fa42f38Snjoly# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 223fa42f38Snjoly# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 233fa42f38Snjoly# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 243fa42f38Snjoly# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 253fa42f38Snjoly# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 263fa42f38Snjoly# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 273fa42f38Snjoly# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 283fa42f38Snjoly# POSSIBILITY OF SUCH DAMAGE. 293fa42f38Snjoly# 303fa42f38Snjoly 31*cdcce7d4Sjmmvatf_test_case prefix 32*cdcce7d4Sjmmvprefix_head() { 33*cdcce7d4Sjmmv atf_set "descr" "Test adding a prefix to a single target" 34*cdcce7d4Sjmmv atf_set "require.progs" "mkdep cc" 35*cdcce7d4Sjmmv} 36*cdcce7d4Sjmmvprefix_body() { 37*cdcce7d4Sjmmv 38*cdcce7d4Sjmmv atf_check touch sample.c 39*cdcce7d4Sjmmv 40*cdcce7d4Sjmmv atf_check mkdep -f sample.d -P some/path/ sample.c 41*cdcce7d4Sjmmv atf_check -o ignore grep '^some/path/sample.o:' sample.d 42*cdcce7d4Sjmmv} 43*cdcce7d4Sjmmv 443fa42f38Snjolyatf_test_case suffixes 453fa42f38Snjolysuffixes_head() { 463fa42f38Snjoly atf_set "descr" "Test suffixes list" 476e845fb5Snjoly atf_set "require.progs" "mkdep cc" 483fa42f38Snjoly} 493fa42f38Snjolysuffixes_body() { 503fa42f38Snjoly 513fa42f38Snjoly atf_check touch sample.c 523fa42f38Snjoly 533fa42f38Snjoly # No list 543fa42f38Snjoly atf_check mkdep -f sample.d sample.c 553fa42f38Snjoly atf_check -o ignore grep '^sample.o:' sample.d 563fa42f38Snjoly 573fa42f38Snjoly # Suffix list 583fa42f38Snjoly atf_check mkdep -f sample.d -s '.a .b' sample.c 5915f57fb0Snjoly atf_check -o ignore grep '^sample.b sample.a:' sample.d 603fa42f38Snjoly 613fa42f38Snjoly # Empty list 623fa42f38Snjoly atf_check mkdep -f sample.d -s '' sample.c 633fa42f38Snjoly atf_check -o ignore grep '^sample:' sample.d 643fa42f38Snjoly} 653fa42f38Snjoly 66*cdcce7d4Sjmmvatf_test_case prefix_and_suffixes 67*cdcce7d4Sjmmvprefix_and_suffixes_head() { 68*cdcce7d4Sjmmv atf_set "descr" "Test the combination of a prefix and suffixes" 69*cdcce7d4Sjmmv atf_set "require.progs" "mkdep cc" 70*cdcce7d4Sjmmv} 71*cdcce7d4Sjmmvprefix_and_suffixes_body() { 72*cdcce7d4Sjmmv 73*cdcce7d4Sjmmv atf_check touch sample.c 74*cdcce7d4Sjmmv 75*cdcce7d4Sjmmv atf_check mkdep -f sample.d -s '.a .b' -P c/d sample.c 76*cdcce7d4Sjmmv atf_check -o ignore grep '^c/dsample.b c/dsample.a:' sample.d 77*cdcce7d4Sjmmv} 78*cdcce7d4Sjmmv 793fa42f38Snjolyatf_init_test_cases() { 80*cdcce7d4Sjmmv atf_add_test_case prefix 813fa42f38Snjoly atf_add_test_case suffixes 82*cdcce7d4Sjmmv atf_add_test_case prefix_and_suffixes 833fa42f38Snjoly} 84