t_sets.sh revision 1.3
1# $NetBSD: t_sets.sh,v 1.3 2024/01/28 19:08:06 riastradh Exp $ 2# 3# Copyright (c) 2024 The NetBSD Foundation, Inc. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25# POSSIBILITY OF SUCH DAMAGE. 26# 27 28check_mtree() 29{ 30 local set=$1 31 32 cd / 33 atf_check -o empty -s eq:0 \ 34 mtree -e </etc/mtree/set."$set" 35} 36 37set_case() 38{ 39 local set=$1 40 41 eval "set_${set}_head() { atf_set descr \"/etc/mtree/set.${set}\"; }" 42 eval "set_${set}_body() { check_mtree ${set}; }" 43} 44 45set_case base 46set_case comp 47set_case debug 48set_case dtb 49#set_case etc 50set_case games 51set_case gpufw 52set_case man 53set_case misc 54set_case modules 55set_case rescue 56set_case tests 57set_case text 58set_case xbase 59set_case xcomp 60set_case xdebug 61#set_case xetc 62set_case xfont 63set_case xserver 64 65atf_init_test_cases() 66{ 67 68 # base is always installed -- hard-code this in case we make a 69 # mistake with the automatic set detection. 70 atf_add_test_case set_base 71 72 # Test all of the sets that are installed, except for some 73 # special cases. 74 for mtree in /etc/mtree/set.*; do 75 set=${mtree#/etc/mtree/set.} 76 case $set in 77 base) # Handled above already. 78 continue 79 ;; 80 etc|xetc) 81 # etc and xetc have files that may be modified 82 # on installation, and also contain log files, 83 # so let's skip them for now. 84 continue 85 ;; 86 *) ;; 87 esac 88 atf_add_test_case set_"${set}" 89 done 90} 91