1#!/bin/sh 2# Test of fmtmsg function family. 3# Copyright (C) 2000-2022 Free Software Foundation, Inc. 4# This file is part of the GNU C Library. 5 6# The GNU C Library is free software; you can redistribute it and/or 7# modify it under the terms of the GNU Lesser General Public 8# License as published by the Free Software Foundation; either 9# version 2.1 of the License, or (at your option) any later version. 10 11# The GNU C Library is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Lesser General Public License for more details. 15 16# You should have received a copy of the GNU Lesser General Public 17# License along with the GNU C Library; if not, see 18# <https://www.gnu.org/licenses/>. 19 20set -e 21 22common_objpfx=$1 23test_program_prefix_before_env=$2 24run_program_env=$3 25test_program_prefix_after_env=$4 26objpfx=$5 27 28test_pre="${test_program_prefix_before_env} ${run_program_env}" 29test="${test_program_prefix_after_env} ${objpfx}tst-fmtmsg" 30out=${objpfx}tst-fmtmsg.out 31 32($test_pre MSGVERB= $test || exit 1; 33 $test_pre MSGVERB=label $test || exit 1; 34 $test_pre MSGVERB=severity $test || exit 1; 35 $test_pre MSGVERB=severity:label $test || exit 1; 36 $test_pre MSGVERB=text $test || exit 1; 37 $test_pre MSGVERB=text:label $test || exit 1; 38 $test_pre MSGVERB=text:severity $test || exit 1; 39 $test_pre MSGVERB=text:severity:label $test || exit 1; 40 $test_pre MSGVERB=action $test || exit 1; 41 $test_pre MSGVERB=action:label $test || exit 1; 42 $test_pre MSGVERB=action:severity $test || exit 1; 43 $test_pre MSGVERB=action:severity:label $test || exit 1; 44 $test_pre MSGVERB=action:text $test || exit 1; 45 $test_pre MSGVERB=action:text:label $test || exit 1; 46 $test_pre MSGVERB=action:text:severity $test || exit 1; 47 $test_pre MSGVERB=action:text:severity:label $test || exit 1; 48 $test_pre MSGVERB=tag $test || exit 1; 49 $test_pre MSGVERB=tag:label $test || exit 1; 50 $test_pre MSGVERB=tag:severity $test || exit 1; 51 $test_pre MSGVERB=tag:severity:label $test || exit 1; 52 $test_pre MSGVERB=tag:text $test || exit 1; 53 $test_pre MSGVERB=tag:text:label $test || exit 1; 54 $test_pre MSGVERB=tag:text:severity $test || exit 1; 55 $test_pre MSGVERB=tag:text:severity:label $test || exit 1; 56 $test_pre MSGVERB=tag:action $test || exit 1; 57 $test_pre MSGVERB=tag:action:label $test || exit 1; 58 $test_pre MSGVERB=tag:action:severity $test || exit 1; 59 $test_pre MSGVERB=tag:action:severity:label $test || exit 1; 60 $test_pre MSGVERB=tag:action:text $test || exit 1; 61 $test_pre MSGVERB=tag:action:text:label $test || exit 1; 62 $test_pre MSGVERB=tag:action:text:severity $test || exit 1; 63 $test_pre MSGVERB=tag:action:text:severity:label $test || exit 1;) 2> $out 64 65cmp $out <<EOF 66GLIBC:tst-fmtmsg: HALT: halt 67TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 68GLIBC:tst-fmtmsg: ERROR: halt 69TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 70GLIBC:tst-fmtmsg: WARNING: halt 71TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 72GLIBC:tst-fmtmsg: INFO: halt 73TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 74GLIBC:tst-fmtmsg: halt 75TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 76GLIBC:tst-fmtmsg: TEST: halt 77TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 78GLIBC:tst-fmtmsg 79GLIBC:tst-fmtmsg 80GLIBC:tst-fmtmsg 81GLIBC:tst-fmtmsg 82GLIBC:tst-fmtmsg 83GLIBC:tst-fmtmsg 84HALT 85ERROR 86WARNING 87INFO 88 89TEST 90GLIBC:tst-fmtmsg: HALT 91GLIBC:tst-fmtmsg: ERROR 92GLIBC:tst-fmtmsg: WARNING 93GLIBC:tst-fmtmsg: INFO 94GLIBC:tst-fmtmsg 95GLIBC:tst-fmtmsg: TEST 96halt 97halt 98halt 99halt 100halt 101halt 102GLIBC:tst-fmtmsg: halt 103GLIBC:tst-fmtmsg: halt 104GLIBC:tst-fmtmsg: halt 105GLIBC:tst-fmtmsg: halt 106GLIBC:tst-fmtmsg: halt 107GLIBC:tst-fmtmsg: halt 108HALT: halt 109ERROR: halt 110WARNING: halt 111INFO: halt 112halt 113TEST: halt 114GLIBC:tst-fmtmsg: HALT: halt 115GLIBC:tst-fmtmsg: ERROR: halt 116GLIBC:tst-fmtmsg: WARNING: halt 117GLIBC:tst-fmtmsg: INFO: halt 118GLIBC:tst-fmtmsg: halt 119GLIBC:tst-fmtmsg: TEST: halt 120TO FIX: should print message for MM_HALT 121TO FIX: should print message for MM_ERROR 122TO FIX: should print message for MM_WARNING 123TO FIX: should print message for MM_INFO 124TO FIX: should print message for MM_NOSEV 125TO FIX: should print message for MM_TEST 126GLIBC:tst-fmtmsg: TO FIX: should print message for MM_HALT 127GLIBC:tst-fmtmsg: TO FIX: should print message for MM_ERROR 128GLIBC:tst-fmtmsg: TO FIX: should print message for MM_WARNING 129GLIBC:tst-fmtmsg: TO FIX: should print message for MM_INFO 130GLIBC:tst-fmtmsg: TO FIX: should print message for MM_NOSEV 131GLIBC:tst-fmtmsg: TO FIX: should print message for MM_TEST 132HALT: TO FIX: should print message for MM_HALT 133ERROR: TO FIX: should print message for MM_ERROR 134WARNING: TO FIX: should print message for MM_WARNING 135INFO: TO FIX: should print message for MM_INFO 136TO FIX: should print message for MM_NOSEV 137TEST: TO FIX: should print message for MM_TEST 138GLIBC:tst-fmtmsg: HALT: TO FIX: should print message for MM_HALT 139GLIBC:tst-fmtmsg: ERROR: TO FIX: should print message for MM_ERROR 140GLIBC:tst-fmtmsg: WARNING: TO FIX: should print message for MM_WARNING 141GLIBC:tst-fmtmsg: INFO: TO FIX: should print message for MM_INFO 142GLIBC:tst-fmtmsg: TO FIX: should print message for MM_NOSEV 143GLIBC:tst-fmtmsg: TEST: TO FIX: should print message for MM_TEST 144halt 145TO FIX: should print message for MM_HALT 146halt 147TO FIX: should print message for MM_ERROR 148halt 149TO FIX: should print message for MM_WARNING 150halt 151TO FIX: should print message for MM_INFO 152halt 153TO FIX: should print message for MM_NOSEV 154halt 155TO FIX: should print message for MM_TEST 156GLIBC:tst-fmtmsg: halt 157TO FIX: should print message for MM_HALT 158GLIBC:tst-fmtmsg: halt 159TO FIX: should print message for MM_ERROR 160GLIBC:tst-fmtmsg: halt 161TO FIX: should print message for MM_WARNING 162GLIBC:tst-fmtmsg: halt 163TO FIX: should print message for MM_INFO 164GLIBC:tst-fmtmsg: halt 165TO FIX: should print message for MM_NOSEV 166GLIBC:tst-fmtmsg: halt 167TO FIX: should print message for MM_TEST 168HALT: halt 169TO FIX: should print message for MM_HALT 170ERROR: halt 171TO FIX: should print message for MM_ERROR 172WARNING: halt 173TO FIX: should print message for MM_WARNING 174INFO: halt 175TO FIX: should print message for MM_INFO 176halt 177TO FIX: should print message for MM_NOSEV 178TEST: halt 179TO FIX: should print message for MM_TEST 180GLIBC:tst-fmtmsg: HALT: halt 181TO FIX: should print message for MM_HALT 182GLIBC:tst-fmtmsg: ERROR: halt 183TO FIX: should print message for MM_ERROR 184GLIBC:tst-fmtmsg: WARNING: halt 185TO FIX: should print message for MM_WARNING 186GLIBC:tst-fmtmsg: INFO: halt 187TO FIX: should print message for MM_INFO 188GLIBC:tst-fmtmsg: halt 189TO FIX: should print message for MM_NOSEV 190GLIBC:tst-fmtmsg: TEST: halt 191TO FIX: should print message for MM_TEST 192GLIBC:tst-fmtmsg:1 193GLIBC:tst-fmtmsg:2 194GLIBC:tst-fmtmsg:3 195GLIBC:tst-fmtmsg:4 196GLIBC:tst-fmtmsg:5 197GLIBC:tst-fmtmsg:6 198GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:1 199GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:2 200GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:3 201GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:4 202GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:5 203GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:6 204HALT: GLIBC:tst-fmtmsg:1 205ERROR: GLIBC:tst-fmtmsg:2 206WARNING: GLIBC:tst-fmtmsg:3 207INFO: GLIBC:tst-fmtmsg:4 208GLIBC:tst-fmtmsg:5 209TEST: GLIBC:tst-fmtmsg:6 210GLIBC:tst-fmtmsg: HALT: GLIBC:tst-fmtmsg:1 211GLIBC:tst-fmtmsg: ERROR: GLIBC:tst-fmtmsg:2 212GLIBC:tst-fmtmsg: WARNING: GLIBC:tst-fmtmsg:3 213GLIBC:tst-fmtmsg: INFO: GLIBC:tst-fmtmsg:4 214GLIBC:tst-fmtmsg: GLIBC:tst-fmtmsg:5 215GLIBC:tst-fmtmsg: TEST: GLIBC:tst-fmtmsg:6 216halt 217GLIBC:tst-fmtmsg:1 218halt 219GLIBC:tst-fmtmsg:2 220halt 221GLIBC:tst-fmtmsg:3 222halt 223GLIBC:tst-fmtmsg:4 224halt 225GLIBC:tst-fmtmsg:5 226halt 227GLIBC:tst-fmtmsg:6 228GLIBC:tst-fmtmsg: halt 229GLIBC:tst-fmtmsg:1 230GLIBC:tst-fmtmsg: halt 231GLIBC:tst-fmtmsg:2 232GLIBC:tst-fmtmsg: halt 233GLIBC:tst-fmtmsg:3 234GLIBC:tst-fmtmsg: halt 235GLIBC:tst-fmtmsg:4 236GLIBC:tst-fmtmsg: halt 237GLIBC:tst-fmtmsg:5 238GLIBC:tst-fmtmsg: halt 239GLIBC:tst-fmtmsg:6 240HALT: halt 241GLIBC:tst-fmtmsg:1 242ERROR: halt 243GLIBC:tst-fmtmsg:2 244WARNING: halt 245GLIBC:tst-fmtmsg:3 246INFO: halt 247GLIBC:tst-fmtmsg:4 248halt 249GLIBC:tst-fmtmsg:5 250TEST: halt 251GLIBC:tst-fmtmsg:6 252GLIBC:tst-fmtmsg: HALT: halt 253GLIBC:tst-fmtmsg:1 254GLIBC:tst-fmtmsg: ERROR: halt 255GLIBC:tst-fmtmsg:2 256GLIBC:tst-fmtmsg: WARNING: halt 257GLIBC:tst-fmtmsg:3 258GLIBC:tst-fmtmsg: INFO: halt 259GLIBC:tst-fmtmsg:4 260GLIBC:tst-fmtmsg: halt 261GLIBC:tst-fmtmsg:5 262GLIBC:tst-fmtmsg: TEST: halt 263GLIBC:tst-fmtmsg:6 264TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 265TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 266TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 267TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 268TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 269TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 270GLIBC:tst-fmtmsg: TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 271GLIBC:tst-fmtmsg: TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 272GLIBC:tst-fmtmsg: TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 273GLIBC:tst-fmtmsg: TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 274GLIBC:tst-fmtmsg: TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 275GLIBC:tst-fmtmsg: TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 276HALT: TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 277ERROR: TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 278WARNING: TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 279INFO: TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 280TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 281TEST: TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 282GLIBC:tst-fmtmsg: HALT: TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 283GLIBC:tst-fmtmsg: ERROR: TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 284GLIBC:tst-fmtmsg: WARNING: TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 285GLIBC:tst-fmtmsg: INFO: TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 286GLIBC:tst-fmtmsg: TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 287GLIBC:tst-fmtmsg: TEST: TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 288halt 289TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 290halt 291TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 292halt 293TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 294halt 295TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 296halt 297TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 298halt 299TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 300GLIBC:tst-fmtmsg: halt 301TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 302GLIBC:tst-fmtmsg: halt 303TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 304GLIBC:tst-fmtmsg: halt 305TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 306GLIBC:tst-fmtmsg: halt 307TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 308GLIBC:tst-fmtmsg: halt 309TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 310GLIBC:tst-fmtmsg: halt 311TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 312HALT: halt 313TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 314ERROR: halt 315TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 316WARNING: halt 317TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 318INFO: halt 319TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 320halt 321TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 322TEST: halt 323TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 324GLIBC:tst-fmtmsg: HALT: halt 325TO FIX: should print message for MM_HALT GLIBC:tst-fmtmsg:1 326GLIBC:tst-fmtmsg: ERROR: halt 327TO FIX: should print message for MM_ERROR GLIBC:tst-fmtmsg:2 328GLIBC:tst-fmtmsg: WARNING: halt 329TO FIX: should print message for MM_WARNING GLIBC:tst-fmtmsg:3 330GLIBC:tst-fmtmsg: INFO: halt 331TO FIX: should print message for MM_INFO GLIBC:tst-fmtmsg:4 332GLIBC:tst-fmtmsg: halt 333TO FIX: should print message for MM_NOSEV GLIBC:tst-fmtmsg:5 334GLIBC:tst-fmtmsg: TEST: halt 335TO FIX: should print message for MM_TEST GLIBC:tst-fmtmsg:6 336EOF 337exit $? 338