aboutsummaryrefslogtreecommitdiff
blob: ad0a5ea5aea1475c45d000df4cd2a09ff11952ee (plain)
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
#! /bin/bash
#
# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
# Copyright (c) 2004, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2

. common-functions.sh

tmpfile=$(tempfilename)

strip_versioned_files() {
	grep -v "/usr/share/doc"
}

test_files() {
	equery files bash > ${tmpfile}

	x=$(grep man ${tmpfile} | wc -l)
	assert_ge ${FUNCNAME} $x 5
	
	x=$(cat ${tmpfile} | wc -l)
	assert_ge ${FUNCNAME} $x 25
}

test_files_timestamp() {
	equery files --timestamp bash > ${tmpfile}

	x=$(grep "/bin/bash .*....-..-.. ..:..:.." ${tmpfile} | wc -l)
	assert_eq ${FUNCNAME} $x 1
}

test_files_md5sum() {
	equery files --md5sum bash > ${tmpfile}
	
	x=$(egrep "/bin/bash .*[0-9a-z]{30}" ${tmpfile} | wc -l)
	assert_eq ${FUNCNAME} $x 1
}

test_files_type() {

	equery files --type bash > ${tmpfile}

	x=$(grep "file.*/bin/bash$" ${tmpfile} | wc -l)
	assert_eq ${FUNCNAME} $x 1
	
	x=$(grep "symlink.*/bin/rbash" ${tmpfile} | wc -l)
	assert_eq ${FUNCNAME} $x 1
	
	x=$(grep "dir.*/usr/share/man" ${tmpfile} | wc -l)
	assert_ge ${FUNCNAME} $x 1 	
}

# Run tests

test_files
test_files_timestamp
test_files_md5sum
test_files_type

rm ${tmpfile}