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_head() { 31272343Sngie atf_set "require.progs" "/usr/bin/mandoc" 32272343Sngie} 33272343Sngiedefaults__build_and_install_body() { 34272343Sngie cat >hello.c <<EOF 35272343Sngie#include <stdio.h> 36272343Sngieint main(void) { printf("Hello, test!\n"); return 0; } 37272343SngieEOF 38272343Sngie cat >hello.1 <<EOF 39272343SngieManpage of hello(1). 40272343SngieEOF 41272343Sngie 42272343Sngie cat >Makefile <<EOF 43272343SngieBINDIR = /the/bin/dir 44272343SngiePROG = hello 45272343Sngie.include <bsd.prog.mk> 46272343SngieEOF 47272343Sngie 48272343Sngie atf_check -o ignore make 49272343Sngie mkdir -p root/the/bin/dir 50272343Sngie mkdir -p root/usr/share/man/man1 51272343Sngie mkdir -p root/usr/share/man/html1 52272343Sngie create_make_conf mk.conf owngrp DESTDIR="$(pwd)/root" 53272343Sngie atf_check -o ignore make install 54272343Sngie 55272343Sngie atf_check -o inline:'Hello, test!\n' ./root/the/bin/dir/hello 56272343Sngie atf_check -o inline:'Manpage of hello(1).\n' \ 57272343Sngie cat root/usr/share/man/man1/hello.1 58272343Sngie atf_check -o match:'Manpage of hello' \ 59272343Sngie cat root/usr/share/man/html1/hello.html 60272343Sngie} 61272343Sngie 62272343Sngieatf_test_case without_man__build_and_install 63272343Sngiewithout_man__build_and_install_body() { 64272343Sngie cat >hello.c <<EOF 65272343Sngie#include <stdio.h> 66272343Sngieint main(void) { printf("Hello, test!\n"); return 0; } 67272343SngieEOF 68272343Sngie 69272343Sngie cat >Makefile <<EOF 70272343SngieBINDIR = /the/bin/dir 71272343SngiePROG = hello 72272343SngieMAN = 73272343Sngie.include <bsd.prog.mk> 74272343SngieEOF 75272343Sngie 76272343Sngie atf_check -o ignore make 77272343Sngie mkdir -p root/the/bin/dir 78272343Sngie create_make_conf mk.conf owngrp DESTDIR="$(pwd)/root" 79272343Sngie atf_check -o ignore make install 80272343Sngie 81272343Sngie atf_check -o inline:'Hello, test!\n' ./root/the/bin/dir/hello 82272343Sngie} 83272343Sngie 84272343Sngieatf_init_test_cases() { 85272343Sngie atf_add_test_case defaults__build_and_install 86272343Sngie atf_add_test_case without_man__build_and_install 87272343Sngie} 88