1*57718be8SEnji Cooper# Copyright 2012 Google Inc. 2*57718be8SEnji Cooper# All rights reserved. 3*57718be8SEnji Cooper# 4*57718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without 5*57718be8SEnji Cooper# modification, are permitted provided that the following conditions are 6*57718be8SEnji Cooper# met: 7*57718be8SEnji Cooper# 8*57718be8SEnji Cooper# * Redistributions of source code must retain the above copyright 9*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer. 10*57718be8SEnji Cooper# * Redistributions in binary form must reproduce the above copyright 11*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer in the 12*57718be8SEnji Cooper# documentation and/or other materials provided with the distribution. 13*57718be8SEnji Cooper# * Neither the name of Google Inc. nor the names of its contributors 14*57718be8SEnji Cooper# may be used to endorse or promote products derived from this software 15*57718be8SEnji Cooper# without specific prior written permission. 16*57718be8SEnji Cooper# 17*57718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18*57718be8SEnji Cooper# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*57718be8SEnji Cooper# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20*57718be8SEnji Cooper# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21*57718be8SEnji Cooper# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22*57718be8SEnji Cooper# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23*57718be8SEnji Cooper# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24*57718be8SEnji Cooper# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25*57718be8SEnji Cooper# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26*57718be8SEnji Cooper# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27*57718be8SEnji Cooper# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*57718be8SEnji Cooper 29*57718be8SEnji Cooperatf_test_case makeconf__ok 30*57718be8SEnji Coopermakeconf__ok_body() { 31*57718be8SEnji Cooper cat >Makefile <<EOF 32*57718be8SEnji CooperA_TEST_CONFIG_VARIABLE = not overriden 33*57718be8SEnji Cooper 34*57718be8SEnji Cooper.PHONY: show-config-var 35*57718be8SEnji Coopershow-config-var: 36*57718be8SEnji Cooper @echo \${A_TEST_CONFIG_VARIABLE} 37*57718be8SEnji Cooper 38*57718be8SEnji Cooper.include <bsd.own.mk> 39*57718be8SEnji CooperEOF 40*57718be8SEnji Cooper 41*57718be8SEnji Cooper echo >empty.conf 42*57718be8SEnji Cooper cat >custom.conf <<EOF 43*57718be8SEnji CooperA_TEST_CONFIG_VARIABLE = 'a value' 44*57718be8SEnji CooperEOF 45*57718be8SEnji Cooper atf_check -o inline:'not overriden\n' \ 46*57718be8SEnji Cooper make MAKECONF="$(pwd)/empty.conf" show-config-var 47*57718be8SEnji Cooper atf_check -o inline:'a value\n' \ 48*57718be8SEnji Cooper make MAKECONF="$(pwd)/custom.conf" show-config-var 49*57718be8SEnji Cooper} 50*57718be8SEnji Cooper 51*57718be8SEnji Cooperatf_test_case makeconf__missing 52*57718be8SEnji Coopermakeconf__missing_body() { 53*57718be8SEnji Cooper cat >Makefile <<EOF 54*57718be8SEnji Cooper.PHONY: hello 55*57718be8SEnji Cooperhello: 56*57718be8SEnji Cooper @echo 'Did not error out on a missing file!' 57*57718be8SEnji Cooper 58*57718be8SEnji Cooper.include <bsd.own.mk> 59*57718be8SEnji CooperEOF 60*57718be8SEnji Cooper 61*57718be8SEnji Cooper echo >empty.conf 62*57718be8SEnji Cooper cat >custom.conf <<EOF 63*57718be8SEnji CooperA_TEST_CONFIG_VARIABLE = 'a value' 64*57718be8SEnji CooperEOF 65*57718be8SEnji Cooper atf_check -o inline:'Did not error out on a missing file!\n' \ 66*57718be8SEnji Cooper make MAKECONF="$(pwd)/non-existent.conf" hello 67*57718be8SEnji Cooper} 68*57718be8SEnji Cooper 69*57718be8SEnji Cooperatf_init_test_cases() { 70*57718be8SEnji Cooper atf_add_test_case makeconf__ok 71*57718be8SEnji Cooper atf_add_test_case makeconf__missing 72*57718be8SEnji Cooper} 73