Debian Codegraph @

src/tests/find

raw
1 #! /bin/sh
2
3 # Copyright (C) 2011, 2012 Colin Watson.
4 #
5 # This file is part of binfmt-support.
6 #
7 # binfmt-support is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 3 of the License, or (at your
10 # option) any later version.
11 #
12 # binfmt-support is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 # Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with binfmt-support; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
21 # Test update-binfmts --find.
22
23 : "${srcdir=.}"
24 # shellcheck source-path=SCRIPTDIR
25 . "$srcdir/testlib.sh"
26
27 init
28 fake_proc
29
30 update_binfmts_proc --install test /bin/sh --magic ABCD
31 report 'magic: install' "$?"
32 echo 'ABCD' >"$tmpdir/program.ext"
33 chmod +x "$tmpdir/program.ext"
34 echo /bin/sh >"$tmpdir/1.exp"
35 update_binfmts_proc --find "$tmpdir/program.ext" >"$tmpdir/1.out"
36 report 'magic: run find' "$?"
37 expect_files_equal 'magic: find result OK' "$tmpdir/1.out" "$tmpdir/1.exp"
38
39 update_binfmts_proc --disable test
40 report 'magic: disable' "$?"
41 touch "$tmpdir/2.exp"
42 update_binfmts_proc --find "$tmpdir/program.ext" >"$tmpdir/2.out"
43 report 'magic: run find (disabled)' "$?"
44 expect_files_equal 'magic: find result OK' "$tmpdir/2.out" "$tmpdir/2.exp"
45
46 finish