]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/functions.sh
tests: logger with socat device
[thirdparty/util-linux.git] / tests / functions.sh
1 #
2 # Copyright (C) 2007 Karel Zak <kzak@redhat.com>
3 #
4 # This file is part of util-linux.
5 #
6 # This file is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This file 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
14 # GNU General Public License for more details.
15 #
16
17
18 function ts_abspath {
19 cd $1
20 pwd
21 }
22
23 function ts_canonicalize {
24 P="$1"
25 C=$(readlink -f $P)
26
27 if [ -n "$C" ]; then
28 echo "$C"
29 else
30 echo "$P"
31 fi
32 }
33
34 function ts_cd {
35 if [ $# -eq 0 ]; then
36 ts_failed "ul_cd: not enough arguments"
37 fi
38 DEST=$(readlink -f "$1" 2>/dev/null)
39 if [ "x$DEST" = "x" ] || [ ! -d "$DEST" ]; then
40 ts_failed "ul_cd: $1: no such directory"
41 fi
42 cd "$DEST" 2>/dev/null || ts_failed "ul_cd: $1: cannot change directory"
43 if [ "$PWD" != "$DEST" ]; then
44 ts_failed "ul_cd: $PWD is not $DEST"
45 fi
46 }
47
48 function ts_report {
49 if [ "$TS_PARALLEL" == "yes" ]; then
50 echo "$TS_TITLE $1"
51 else
52 echo "$1"
53 fi
54 }
55
56 function ts_check_test_command {
57 if [ ! -x "$1" ]; then
58 ts_skip "${1##*/} not found"
59 fi
60 }
61
62 function ts_check_prog {
63 local cmd=$1
64 type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
65 }
66
67 function ts_check_losetup {
68 local tmp
69 ts_check_test_command "$TS_CMD_LOSETUP"
70
71 if [ "$TS_SKIP_LOOPDEVS" = "yes" ]; then
72 ts_skip "loop-device tests disabled"
73 fi
74
75 # assuming that losetup -f works ... to be checked somewhere else
76 tmp=$($TS_CMD_LOSETUP -f 2>/dev/null)
77 if test -b "$tmp"; then
78 return 0
79 fi
80 ts_skip "no loop-device support"
81 }
82
83 function ts_skip_subtest {
84 ts_report " SKIPPED ($1)"
85 }
86
87 function ts_skip {
88 ts_skip_subtest "$1"
89 if [ -n "$2" -a -b "$2" ]; then
90 ts_device_deinit "$2"
91 fi
92 exit 0
93 }
94
95 function ts_skip_nonroot {
96 if [ $UID -ne 0 ]; then
97 ts_skip "no root permissions"
98 fi
99 }
100
101 function ts_failed_subtest {
102 local msg="FAILED"
103 local ret=1
104 if [ "$TS_KNOWN_FAIL" = "yes" ]; then
105 msg="KNOWN FAILED"
106 ret=0
107 fi
108
109 if [ x"$1" == x"" ]; then
110 ts_report " $msg ($TS_NS)"
111 else
112 ts_report " $msg ($1)"
113 fi
114
115 return $ret
116 }
117
118 function ts_failed {
119 ts_failed_subtest "$1"
120 exit $?
121 }
122
123 function ts_ok_subtest {
124 if [ x"$1" == x"" ]; then
125 ts_report " OK"
126 else
127 ts_report " OK ($1)"
128 fi
129 }
130
131 function ts_ok {
132 ts_ok_subtest "$1"
133 exit 0
134 }
135
136 function ts_log {
137 echo "$1" >> $TS_OUTPUT
138 [ "$TS_VERBOSE" == "yes" ] && echo "$1"
139 }
140
141 function ts_has_option {
142 NAME="$1"
143 ALL="$2"
144
145 # user may set options by env for a single test or whole component
146 # e.g. TS_OPT_ipcs_limits2_fake="yes" or TS_OPT_ipcs_fake="yes"
147 local v_test=${TS_TESTNAME//[-.]/_}
148 local v_comp=${TS_COMPONENT//[-.]/_}
149 local v_name=${NAME//[-.]/_}
150 eval local env_opt_test=\$TS_OPT_${v_comp}_${v_test}_${v_name}
151 eval local env_opt_comp=\$TS_OPT_${v_comp}_${v_name}
152 if [ "$env_opt_test" = "yes" \
153 -o "$env_opt_comp" = "yes" -a "$env_opt_test" != "no" ]; then
154 echo "yes"
155 return
156 elif [ "$env_opt_test" = "no" \
157 -o "$env_opt_comp" = "no" -a "$env_opt_test" != "yes" ]; then
158 return
159 fi
160
161 # or just check the global command line options
162 echo -n $ALL | sed 's/ //g' | awk 'BEGIN { FS="="; RS="--" } /('$NAME'$|'$NAME'=)/ { print "yes" }'
163 }
164
165 function ts_option_argument {
166 NAME="$1"
167 ALL="$2"
168 echo -n $ALL | sed 's/ //g' | awk 'BEGIN { FS="="; RS="--" } /'$NAME'=/ { print $2 }'
169 }
170
171 function ts_init_core_env {
172 TS_NS="$TS_COMPONENT/$TS_TESTNAME"
173 TS_OUTPUT="$TS_OUTDIR/$TS_TESTNAME"
174 TS_VGDUMP="$TS_OUTDIR/$TS_TESTNAME.vgdump"
175 TS_DIFF="$TS_DIFFDIR/$TS_TESTNAME"
176 TS_EXPECTED="$TS_TOPDIR/expected/$TS_NS"
177 TS_MOUNTPOINT="$TS_OUTDIR/${TS_TESTNAME}-mnt"
178 }
179
180 function ts_init_core_subtest_env {
181 TS_NS="$TS_COMPONENT/$TS_TESTNAME-$TS_SUBNAME"
182 TS_OUTPUT="$TS_OUTDIR/$TS_TESTNAME-$TS_SUBNAME"
183 TS_VGDUMP="$TS_OUTDIR/$TS_TESTNAME-$TS_SUBNAME.vgdump"
184 TS_DIFF="$TS_DIFFDIR/$TS_TESTNAME-$TS_SUBNAME"
185 TS_EXPECTED="$TS_TOPDIR/expected/$TS_NS"
186 TS_MOUNTPOINT="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-mnt"
187
188 rm -f $TS_OUTPUT $TS_VGDUMP
189 [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR"
190
191 touch $TS_OUTPUT
192 [ -n "$TS_VALGRIND_CMD" ] && touch $TS_VGDUMP
193 }
194
195 function ts_init_env {
196 local mydir=$(ts_abspath ${0%/*})
197 local tmp
198
199 LANG="POSIX"
200 LANGUAGE="POSIX"
201 LC_ALL="POSIX"
202 CHARSET="UTF-8"
203
204 export LANG LANGUAGE LC_ALL CHARSET
205
206 mydir=$(ts_canonicalize "$mydir")
207
208 # automake directories
209 top_srcdir=$(ts_option_argument "srcdir" "$*")
210 top_builddir=$(ts_option_argument "builddir" "$*")
211
212 # where is this script
213 TS_TOPDIR=$(ts_abspath $mydir/../../)
214
215 # default
216 if [ -z "$top_srcdir" ]; then
217 top_srcdir="$TS_TOPDIR/.."
218 fi
219 if [ -z "$top_builddir" ]; then
220 top_builddir="$TS_TOPDIR/.."
221 fi
222
223 top_srcdir=$(ts_abspath $top_srcdir)
224 top_builddir=$(ts_abspath $top_builddir)
225
226 TS_SCRIPT="$mydir/$(basename $0)"
227 TS_SUBDIR=$(dirname $TS_SCRIPT)
228 TS_TESTNAME=$(basename $TS_SCRIPT)
229 TS_COMPONENT=$(basename $TS_SUBDIR)
230
231 TS_NSUBTESTS=0
232 TS_NSUBFAILED=0
233
234 TS_SELF="$TS_SUBDIR"
235
236 TS_OUTDIR="$top_builddir/tests/output/$TS_COMPONENT"
237 TS_DIFFDIR="$top_builddir/tests/diff/$TS_COMPONENT"
238
239 ts_init_core_env
240
241 TS_VERBOSE=$(ts_has_option "verbose" "$*")
242 TS_PARALLEL=$(ts_has_option "parallel" "$*")
243 TS_KNOWN_FAIL=$(ts_has_option "known-fail" "$*")
244 TS_SKIP_LOOPDEVS=$(ts_has_option "skip-loopdevs" "$*")
245
246 tmp=$( ts_has_option "memcheck" "$*")
247 if [ "$tmp" == "yes" -a -f /usr/bin/valgrind ]; then
248 TS_VALGRIND_CMD="/usr/bin/valgrind"
249 fi
250
251 BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
252
253 declare -a TS_SUID_PROGS
254 declare -a TS_SUID_USER
255 declare -a TS_SUID_GROUP
256
257 if [ -f $TS_TOPDIR/commands.sh ]; then
258 . $TS_TOPDIR/commands.sh
259 fi
260
261 export BLKID_FILE
262
263 rm -f $TS_OUTPUT $TS_VGDUMP
264 [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR"
265
266 touch $TS_OUTPUT
267 [ -n "$TS_VALGRIND_CMD" ] && touch $TS_VGDUMP
268
269 if [ "$TS_VERBOSE" == "yes" ]; then
270 echo
271 echo " script: $TS_SCRIPT"
272 echo " sub dir: $TS_SUBDIR"
273 echo " top dir: $TS_TOPDIR"
274 echo " self: $TS_SELF"
275 echo " test name: $TS_TESTNAME"
276 echo " test desc: $TS_DESC"
277 echo " component: $TS_COMPONENT"
278 echo " namespace: $TS_NS"
279 echo " verbose: $TS_VERBOSE"
280 echo " output: $TS_OUTPUT"
281 echo " valgrind: $TS_VGDUMP"
282 echo " expected: $TS_EXPECTED"
283 echo " mountpoint: $TS_MOUNTPOINT"
284 echo
285 fi
286 }
287
288 function ts_init_subtest {
289
290 TS_SUBNAME="$1"
291
292 ts_init_core_subtest_env
293
294 [ $TS_NSUBTESTS -eq 0 ] && echo
295 TS_NSUBTESTS=$(( $TS_NSUBTESTS + 1 ))
296
297 if [ "$TS_PARALLEL" == "yes" ]; then
298 TS_TITLE=$(printf "%13s: %-30s ...\n%16s: %-27s ..." "$TS_COMPONENT" "$TS_DESC" "" "$TS_SUBNAME")
299 else
300 TS_TITLE=$(printf "%16s: %-27s ..." "" "$TS_SUBNAME")
301 echo -n "$TS_TITLE"
302 fi
303 }
304
305 function ts_init {
306 ts_init_env "$*"
307
308 local is_fake=$( ts_has_option "fake" "$*")
309 local is_force=$( ts_has_option "force" "$*")
310
311 if [ "$TS_PARALLEL" == "yes" ]; then
312 TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC")
313 else
314 TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC")
315 echo -n "$TS_TITLE"
316 fi
317
318 [ "$is_fake" == "yes" ] && ts_skip "fake mode"
319 [ "$TS_OPTIONAL" == "yes" -a "$is_force" != "yes" ] && ts_skip "optional"
320 }
321
322 function ts_init_suid {
323 PROG="$1"
324 ct=${#TS_SUID_PROGS[*]}
325
326 # Save info about original setting
327 TS_SUID_PROGS[$ct]=$PROG
328 TS_SUID_USER[$ct]=$(stat --printf="%U" $PROG)
329 TS_SUID_GROUP[$ct]=$(stat --printf="%G" $PROG)
330
331 chown root.root $PROG &> /dev/null
332 chmod u+s $PROG &> /dev/null
333 }
334
335 function ts_init_py {
336 LIBNAME="$1"
337
338 [ -f "$top_builddir/py${LIBNAME}.la" ] || ts_skip "py${LIBNAME} not compiled"
339
340 export LD_LIBRARY_PATH="$top_builddir/.libs:$LD_LIBRARY_PATH"
341 export PYTHONPATH="$top_builddir/$LIBNAME/python:$top_builddir/.libs:$PYTHONPATH"
342
343 export PYTHON_VERSION=$(awk '/^PYTHON_VERSION/ { print $3 }' $top_builddir/Makefile)
344 export PYTHON_MAJOR_VERSION=$(echo $PYTHON_VERSION | sed 's/\..*//')
345
346 export PYTHON="python${PYTHON_MAJOR_VERSION}"
347 }
348
349 function ts_valgrind {
350 if [ -z "$TS_VALGRIND_CMD" ]; then
351 $*
352 else
353 $TS_VALGRIND_CMD --tool=memcheck --leak-check=full \
354 --leak-resolution=high --num-callers=20 \
355 --log-file="$TS_VGDUMP" $*
356 fi
357 }
358
359 function ts_gen_diff {
360 local res=0
361
362 if [ -s "$TS_OUTPUT" ]; then
363
364 # remove libtool lt- prefixes
365 sed --in-place 's/^lt\-\(.*\: \)/\1/g' $TS_OUTPUT
366
367 [ -d "$TS_DIFFDIR" ] || mkdir -p "$TS_DIFFDIR"
368 diff -u $TS_EXPECTED $TS_OUTPUT > $TS_DIFF
369
370 if [ -s $TS_DIFF ]; then
371 res=1
372 else
373 rm -f $TS_DIFF;
374 fi
375 else
376 res=1
377 fi
378 return $res
379 }
380
381 function tt_gen_mem_report {
382 [ -z "$TS_VALGRIND_CMD" ] && echo "$1"
383
384 grep -q -E 'ERROR SUMMARY: [1-9]' $TS_VGDUMP &> /dev/null
385 if [ $? -eq 0 ]; then
386 echo "mem-error detected!"
387 fi
388 }
389
390 function ts_finalize_subtest {
391 local res=0
392
393 if [ -s "$TS_EXPECTED" ]; then
394 ts_gen_diff
395 if [ $? -eq 1 ]; then
396 ts_failed_subtest "$1"
397 res=1
398 else
399 ts_ok_subtest "$(tt_gen_mem_report "$1")"
400 fi
401 else
402 ts_skip_subtest "output undefined"
403 fi
404
405 [ $res -ne 0 ] && TS_NSUBFAILED=$(( $TS_NSUBFAILED + 1 ))
406
407 # reset environment back to parental test
408 ts_init_core_env
409
410 return $res
411 }
412
413 function ts_finalize {
414 for idx in $(seq 0 $((${#TS_SUID_PROGS[*]} - 1))); do
415 PROG=${TS_SUID_PROGS[$idx]}
416 chmod a-s $PROG &> /dev/null
417 chown ${TS_SUID_USER[$idx]}.${TS_SUID_GROUP[$idx]} $PROG &> /dev/null
418 done
419
420 if [ $TS_NSUBTESTS -ne 0 ]; then
421 printf "%11s..."
422 if [ $TS_NSUBFAILED -ne 0 ]; then
423 ts_failed "$TS_NSUBFAILED from $TS_NSUBTESTS sub-tests"
424 else
425 ts_ok "all $TS_NSUBTESTS sub-tests PASSED"
426 fi
427 fi
428
429 if [ -s $TS_EXPECTED ]; then
430 ts_gen_diff
431 if [ $? -eq 1 ]; then
432 ts_failed "$1"
433 fi
434 ts_ok "$1"
435 fi
436
437 ts_skip "output undefined"
438 }
439
440 function ts_die {
441 ts_log "$1"
442 if [ -n "$2" ] && [ -b "$2" ]; then
443 ts_device_deinit "$2"
444 ts_fstab_clean # for sure...
445 fi
446 ts_finalize
447 }
448
449 function ts_image_md5sum {
450 local img=${1:-"$TS_OUTDIR/${TS_TESTNAME}.img"}
451 echo $(md5sum "$img" | awk '{printf $1}') $(basename "$img")
452 }
453
454 function ts_image_init {
455 local mib=${1:-"5"} # size in MiBs
456 local img=${2:-"$TS_OUTDIR/${TS_TESTNAME}.img"}
457
458 dd if=/dev/zero of="$img" bs=1M count=$mib &> /dev/null
459 echo "$img"
460 return 0
461 }
462
463 function ts_device_init {
464 local img
465 local dev
466
467 img=$(ts_image_init $1 $2)
468 dev=$($TS_CMD_LOSETUP --show -f "$img")
469
470 echo $dev
471 }
472
473 function ts_device_deinit {
474 local DEV="$1"
475
476 if [ -b "$DEV" ]; then
477 $TS_CMD_UMOUNT "$DEV" &> /dev/null
478 $TS_CMD_LOSETUP -d "$DEV" &> /dev/null
479 fi
480 }
481
482 function ts_uuid_by_devname {
483 echo $($TS_CMD_BLKID -p -s UUID -o value $1)
484 }
485
486 function ts_label_by_devname {
487 echo $($TS_CMD_BLKID -p -s LABEL -o value $1)
488 }
489
490 function ts_fstype_by_devname {
491 echo $($TS_CMD_BLKID -p -s TYPE -o value $1)
492 }
493
494 function ts_device_has {
495 local TAG="$1"
496 local VAL="$2"
497 local DEV="$3"
498 local vl=""
499
500 case $TAG in
501 "TYPE") vl=$(ts_fstype_by_devname $DEV);;
502 "LABEL") vl=$(ts_label_by_devname $DEV);;
503 "UUID") vl=$(ts_uuid_by_devname $DEV);;
504 *) return 1;;
505 esac
506
507 if [ "$vl" == "$VAL" ]; then
508 return 0
509 fi
510 return 1
511 }
512
513 function ts_device_has_uuid {
514 ts_uuid_by_devname "$1" | egrep -q '^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$'
515 return $?
516 }
517
518 function ts_mount {
519 local out
520 local result
521 local msg
522 local fs
523 local fs_exp=$1
524 shift
525
526 out=$($TS_CMD_MOUNT "$@" 2>&1)
527 result=$?
528 echo -n "$out" >> $TS_OUTPUT
529
530 if [ $result != 0 ] \
531 && msg=$(echo "$out" | grep -m1 "unknown filesystem type")
532 then
533 # skip only if reported fs correctly and if it's not available
534 fs=$(echo "$msg" | sed -n "s/.*type '\(.*\)'$/\1/p")
535 [ "$fs" = "fs_exp" ] \
536 && grep -qe "[[:space:]]${fs}$" /proc/filesystems &>/dev/null \
537 || ts_skip "$msg"
538 fi
539 return $result
540 }
541
542 function ts_is_mounted {
543 local DEV=$(ts_canonicalize "$1")
544
545 grep -q $DEV /proc/mounts && return 0
546
547 if [ "${DEV#/dev/loop/}" != "$DEV" ]; then
548 return grep -q "/dev/loop${DEV#/dev/loop/}" /proc/mounts
549 fi
550 return 1
551 }
552
553 function ts_fstab_open {
554 echo "# <!-- util-linux test entry" >> /etc/fstab
555 }
556
557 function ts_fstab_close {
558 echo "# -->" >> /etc/fstab
559 }
560
561 function ts_fstab_addline {
562 local SPEC="$1"
563 local MNT=${2:-"$TS_MOUNTPOINT"}
564 local FS=${3:-"auto"}
565 local OPT=${4:-"defaults"}
566
567 echo "$SPEC $MNT $FS $OPT 0 0" >> /etc/fstab
568 }
569
570 function ts_fstab_add {
571 ts_fstab_open
572 ts_fstab_addline $*
573 ts_fstab_close
574 }
575
576 function ts_fstab_clean {
577 sed --in-place "
578 /# <!-- util-linux/!b
579 :a
580 /# -->/!{
581 N
582 ba
583 }
584 s/# <!-- util-linux.*-->//;
585 /^$/d" /etc/fstab
586 }
587
588 function ts_fdisk_clean {
589 local DEVNAME=$1
590
591 # remove non comparable parts of fdisk output
592 if [ x"${DEVNAME}" != x"" ]; then
593 sed -i -e "s:${DEVNAME}:<removed>:g" $TS_OUTPUT
594 fi
595
596 sed -i -e 's/Disk identifier:.*/Disk identifier: <removed>/g' \
597 -e 's/Created a new.*/Created a new <removed>./g' \
598 -e 's/^Device[[:blank:]]*Start/Device Start/g' \
599 -e 's/^Device[[:blank:]]*Boot/Device Boot/g' \
600 -e 's/^Device[[:blank:]]*Flag/Device Flag/g' \
601 -e 's/Welcome to fdisk.*/Welcome to fdisk <removed>./g' \
602 $TS_OUTPUT
603 }
604
605 function ts_scsi_debug_init {
606 local devname
607 TS_DEVICE="none"
608
609 # dry run is not really reliable, real modprobe may still fail
610 modprobe --dry-run --quiet scsi_debug &>/dev/null \
611 || ts_skip "missing scsi_debug module (dry-run)"
612
613 # skip if still in use or removal of modules not supported at all
614 modprobe -r scsi_debug &>/dev/null \
615 || ts_skip "cannot remove scsi_debug module (rmmod)"
616
617 modprobe -b scsi_debug "$@" &>/dev/null \
618 || ts_skip "cannot load scsi_debug module (modprobe)"
619
620 # it might be still not loaded, modprobe.conf or whatever
621 lsmod | grep -q "^scsi_debug " \
622 || ts_skip "scsi_debug module not loaded (lsmod)"
623
624 sleep 1
625 udevadm settle
626
627 devname=$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
628 [ "x${devname}" == "x" ] && ts_die "cannot find scsi_debug device"
629
630 TS_DEVICE="/dev/${devname}"
631 }
632
633 function ts_resolve_host {
634 local host="$1"
635 local tmp
636
637 # currently we just resolve default records (might be "A", ipv4 only)
638 if type "dig" >/dev/null 2>&1; then
639 tmp=$(dig "$host" +short 2>/dev/null) || return 1
640 elif type "nslookup" >/dev/null 2>&1; then
641 tmp=$(nslookup "$host" 2>/dev/null) || return 1
642 tmp=$(echo "$tmp"| grep -A1 "^Name:"| grep "^Address:"| cut -d" " -f2)
643 elif type "host" >/dev/null 2>&1; then
644 tmp=$(host "$host" 2>/dev/null) || return 1
645 tmp=$(echo "$tmp" | grep " has address " | cut -d " " -f4)
646 elif type "getent" >/dev/null 2>&1; then
647 tmp=$(getent ahosts "$host" 2>/dev/null) || return 1
648 tmp=$(echo "$tmp" | cut -d " " -f 1 | sort -u)
649 fi
650
651 # we return 1 if tmp is empty
652 test -n "$tmp" || return 1
653 echo "$tmp" | sort -R | head -n 1
654 }
655
656 # listen to unix socket (background socat)
657 function ts_init_socket_to_file {
658 local socket=$1
659 local outfile=$2
660 local pid="0"
661
662 ts_check_prog "socat"
663 rm -f "$socket" "$outfile"
664
665 socat -u UNIX-LISTEN:$socket,fork,max-children=1,backlog=128 \
666 STDOUT > "$outfile" &
667 pid=$!
668
669 # check for running background process
670 if [ "$pid" -le "0" ] || ! kill -s 0 "$pid"; then
671 ts_skip "unable to run socat"
672 fi
673 # wait for the socket listener
674 if ! socat -u /dev/null UNIX-CONNECT:$socket,retry=30,interval=0.1; then
675 kill -9 "$pid"
676 ts_skip "timeout waiting for socket"
677 fi
678 # check socket again
679 if ! socat -u /dev/null UNIX-CONNECT:$socket; then
680 kill -9 "$pid"
681 ts_skip "socket stopped listening"
682 fi
683 }