t_sets.sh revision 1.1
1# $NetBSD: t_sets.sh,v 1.1 2024/01/25 00:30:57 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 echo check_mtree >&2 33 34 cd / 35 atf_check -o empty -s eq:0 \ 36 mtree -e </etc/mtree/set."$set" 37} 38 39set_case() 40{ 41 local set=$1 42 43 eval "set_${set}_head() { atf_set descr \"/etc/mtree/set.${set}\"; }" 44 eval "set_${set}_body() { check_mtree ${set}; }" 45} 46 47set_case base 48set_case comp 49set_case debug 50set_case dtb 51#set_case etc 52set_case games 53set_case gpufw 54set_case man 55set_case misc 56set_case modules 57set_case rescue 58set_case tests 59set_case text 60set_case xbase 61set_case xcomp 62set_case xdebug 63#set_case xetc 64set_case xfont 65set_case xserver 66 67atf_init_test_cases() 68{ 69 70 # base is always installed -- hard-code this in case we make a 71 # mistake with the automatic set detection. 72 atf_add_test_case set_base 73 74 # Test all of the sets that are installed, except for some 75 # special cases. 76 for mtree in /etc/mtree/set.*; do 77 set=${mtree#/etc/mtree/set.} 78 case $set in 79 base) # Handled above already. 80 continue 81 ;; 82 etc|xetc) 83 # etc and xetc have files that may be modified 84 # on installation, and also contain log files, 85 # so let's skip them for now. 86 continue 87 ;; 88 *) ;; 89 esac 90 atf_add_test_case set_"${set}" 91 done 92} 93