#! /bin/sh # Copyright (C) 2010 Colin Watson. # # This file is part of binfmt-support. # # binfmt-support is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # binfmt-support is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with binfmt-support; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Test userspace detectors. : "${srcdir=.}" # shellcheck source-path=SCRIPTDIR . "$srcdir/testlib.sh" init fake_proc for i in 1 2 3; do cat >"$tmpdir/program-$i" <"$tmpdir/detector-$i" <"$tmpdir/input-$i.ext" <"$tmpdir/1-admin.exp" <"$tmpdir/1-proc.exp" <"$tmpdir/2-admin.exp" <"$tmpdir/2-proc.exp" <"$tmpdir/3-admin.exp" <"$tmpdir/3-proc.exp" <"$tmpdir/4.exp" run_detectors "$tmpdir/input-1.ext" --foo=bar file --admindir=baz -v >"$tmpdir/4.out" report 'detector 1: run' "$?" expect_files_equal 'detector 1: output' \ "$tmpdir/4.out" "$tmpdir/4.exp" echo "program-2 $tmpdir/input-2.ext" >"$tmpdir/5.exp" run_detectors "$tmpdir/input-2.ext" >"$tmpdir/5.out" report 'detector 2, without arguments: run' "$?" expect_files_equal 'detector 2, without arguments: output' \ "$tmpdir/5.out" "$tmpdir/5.exp" echo "program-3 $tmpdir/input-3.ext foo --arg" >"$tmpdir/6.exp" run_detectors "$tmpdir/input-3.ext" foo --arg >"$tmpdir/6.out" report 'no detector: run' "$?" expect_files_equal 'no detector: output' \ "$tmpdir/6.out" "$tmpdir/6.exp" echo "program-3 $tmpdir/input-3.ext" >"$tmpdir/7.exp" run_detectors "$tmpdir/input-3.ext" >"$tmpdir/7.out" report 'no detector, without arguments: run' "$?" expect_files_equal 'no detector, without arguments: output' \ "$tmpdir/7.out" "$tmpdir/7.exp" finish