File: test-apt-cli-pager

package info (click to toggle)
apt 3.1.13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,764 kB
  • sloc: cpp: 71,085; sh: 31,750; xml: 5,553; perl: 217; python: 197; ansic: 191; makefile: 41
file content (130 lines) | stat: -rwxr-xr-x 4,422 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
configarchitecture 'amd64'
DESCR='Some description
 That has multiple lines'
insertsource 'unstable' 'foo' 'all' '1.0'
insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
insertpackage 'unstable' 'multi' 'all' '1.0' '' '' "$DESCR"
insertpackage 'unstable' 'multi' 'all' '2.0' '' '' "$DESCR"

setupaptarchive

APTARCHIVE=$(readlink -f ./aptarchive)

cat >> head3 << EOF
#!/bin/sh
exec head -3
EOF

chmod +x head3

for show in info show; do
msgmsg "$show supports pager"
PAGER=cat testsuccessequal "Package: multi
Version: 2.0
Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
 That has multiple lines

N: There is 1 additional record. Please use the '-a' switch to see it" runapt --unbuffer apt $show multi -o TestPager=cat

PAGER="head -3" testsuccessequal "Package: multi
Version: 2.0
Priority: optional" runapt --unbuffer apt $show multi -o TestPager="head -3"

PAGER="cat|./head3" testsuccessequal "Package: multi
Version: 2.0
Priority: optional" runapt --unbuffer apt $show multi -o TestPager="head -3"

# Test that we are not blocking
PAGER=more testsuccessequal "Package: multi
Version: 2.0
Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
 That has multiple lines

N: There is 1 additional record. Please use the '-a' switch to see it" runapt --unbuffer apt $show multi -o TestThatWeAreNotBlocking=1

PAGER=not-a-valid-pager testsuccessequal "Package: multi
Version: 2.0
Priority: optional
Section: other
Maintainer: Joe Sixpack <joe@example.org>
Installed-Size: 43.0 kB
Download-Size: 42 B
APT-Sources: file:$APTARCHIVE unstable/main all Packages
Description: Some description
 That has multiple lines

W: Could not execute pager - PagerSetup (2: No such file or directory)
N: There is 1 additional record. Please use the '-a' switch to see it" runapt --unbuffer apt $show multi -o TestPager="not-a-valid-pager"
PAGER="dd status=none of=/dev/null" testsuccessequal "" runapt --unbuffer apt $show multi  -o Test="everything is paged"
done

msgmsg "list supports pager"
PAGER="head -1" testsuccessequal "foo/unstable 1.0 all
multi/unstable 2.0 all" apt list -qq
PAGER="head -1" testsuccessequal "foo/unstable 1.0 all" runapt --unbuffer apt list -qq -o TestPager="head -1"

PAGER="dd status=none of=/dev/null" testsuccessequal "Listing..." runapt --unbuffer apt list  -o Test="progress is not paged"

msgmsg "search supports pager"
PAGER="head -1" testsuccessequal "foo/unstable 1.0 all
  Some description

multi/unstable 2.0 all
  Some description
" apt search -qq .

PAGER="head -1" testsuccessequal "foo/unstable 1.0 all" runapt --unbuffer apt search -qq . -o TestPager="head -1"

PAGER="dd status=none of=/dev/null" testsuccessequal "Sorting...
Full Text Search..." runapt --unbuffer apt search .  -o Test="progress is not paged"

msgmsg "policy supports pager"
PAGER="head -1" testsuccessequal "foo:
  Installed: (none)
  Candidate: 1.0
  Version table:
     1.0 500
        500 file:${APTARCHIVE} unstable/main all Packages" apt policy foo

PAGER="head -1" testsuccessequal "foo:" runapt --unbuffer apt policy foo -o TestPager="head -1"

PAGER="dd status=none of=/dev/null" testsuccessequal "" runapt --unbuffer apt policy foo  -o Test="everything is paged"

msgmsg "showsrc supports pager"
PAGER="head -2" testsuccessequal "Package: foo
Binary: foo
Version: 1.0
Maintainer: Joe Sixpack <joe@example.org>
Architecture: all
Files:
 b998e085e36cf162e6a33c2801318fef 11 foo_1.0.dsc
 d46b9a02af8487cbeb49165540c88184 14 foo_1.0.tar.gz
Checksums-Sha256:
 ed7c25c832596339bee13e4e7c45cf49f869b60d2bf57252f18191d75866c2a7 11 foo_1.0.dsc
 f3da8c6ebc62c8ef2dae439a498dddcdacc1a07f45ff67ad12f44b6e2353c239 14 foo_1.0.tar.gz
"  runapt apt showsrc foo

PAGER="head -2" testsuccessequal "Package: foo
Binary: foo"  runapt --unbuffer apt showsrc foo -o TestPager="head- 2"

PAGER='echo $LESS' testsuccessequal "FRSXMK"  runapt --unbuffer apt showsrc foo -o TestPager='echo $LESS (1)'
LESS=FRXM PAGER='echo $LESS' testsuccessequal "FRXM"  runapt --unbuffer apt showsrc foo -o TestPager='echo $LESS (2)'