1272343Sngie# Copyright 2012 Google Inc.
2272343Sngie# All rights reserved.
3272343Sngie#
4272343Sngie# Redistribution and use in source and binary forms, with or without
5272343Sngie# modification, are permitted provided that the following conditions are
6272343Sngie# met:
7272343Sngie#
8272343Sngie# * Redistributions of source code must retain the above copyright
9272343Sngie#   notice, this list of conditions and the following disclaimer.
10272343Sngie# * Redistributions in binary form must reproduce the above copyright
11272343Sngie#   notice, this list of conditions and the following disclaimer in the
12272343Sngie#   documentation and/or other materials provided with the distribution.
13272343Sngie# * Neither the name of Google Inc. nor the names of its contributors
14272343Sngie#   may be used to endorse or promote products derived from this software
15272343Sngie#   without specific prior written permission.
16272343Sngie#
17272343Sngie# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18272343Sngie# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19272343Sngie# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20272343Sngie# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21272343Sngie# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22272343Sngie# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23272343Sngie# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24272343Sngie# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25272343Sngie# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26272343Sngie# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27272343Sngie# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28272343Sngie
29272343Sngieatf_test_case defaults__build_and_install
30272343Sngiedefaults__build_and_install_body() {
31272343Sngie	create_c_module module1 first
32272343Sngie	create_c_module module2 second
33272343Sngie
34272343Sngie	cat >Makefile <<EOF
35272343SngieLIB = two-modules
36272343SngieSRCS = module1.c module2.c
37272343Sngie.include <bsd.lib.mk>
38272343SngieEOF
39272343Sngie
40272343Sngie	atf_check -o ignore make
41272343Sngie	mkdir -p root/usr/lib
42272343Sngie	mkdir -p root/usr/libdata/lint
43272343Sngie	create_make_conf mk.conf owngrp DESTDIR="$(pwd)/root"
44272343Sngie	atf_check -o ignore make install
45272343Sngie
46272343Sngie	create_main_using_modules main.c module1.h:first module2.h:second
47272343Sngie	atf_check -o ignore gcc -I. -Lroot/usr/lib -o main main.c -ltwo-modules
48272343Sngie
49272343Sngie	atf_check -o inline:'module1\nmodule2\n' ./main
50272343Sngie}
51272343Sngie
52272343Sngieatf_init_test_cases() {
53272343Sngie	atf_add_test_case defaults__build_and_install
54272343Sngie}
55