public
Description: A bashrc for paludis supporting the Intel C++ compiler and per-package CFLAGS
Homepage: http://ihatenicks.bplaced.net/paludis-bashrc/
Clone URL: git://github.com/ehahn/paludis-bashrc.git
paludis-bashrc / test.bash
100755 76 lines (61 sloc) 1.407 kb
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
#!/bin/bash
 
# Script for testing the bashrc
# © 2008 Erik Hahn, distributed under the GPL v2 or later
 
# Remove old temporary files
rm /tmp/paludisbashrc-*
 
# Set etcdir
etc="./conf.test"
 
# enable debug
debug=1
 
function die(){
echo "ERROR: $1"
exit
}
 
function check(){
source ./bashrc
if [[ "${CC}" == $1 ]] && [[ "${CFLAGS}" == $2 ]] && [[ "$CXXFLAGS" == $CFLAGS ]]; then
echo "Test $3: success"
else
echo "Test $3: failure"
echo "CC="${CC}""
echo "CFLAGS="${CFLAGS}""
echo "CXXFLAGS="${CXXFLAGS}""
fi
}
 
# Test 1: classic category/pn, everything is standard
CATEGORY="dev-libs"
PN="libfoo"
SLOT="0"
check "icc" "-xK -ip -gcc -w -O2" "1"
 
# Test 2: make a full category use gcc
CATEGORY="kde-base"
PN="okular"
SLOT="0"
check "gcc" "-march=native -pipe -O2 -fomit-frame-pointer" "2"
 
# Test 3: overriding variables
CATEGORY="dev-foo"
PN="bar"
SLOT="0"
NCC="gcc" check "gcc" "-march=native -pipe -O2 -fomit-frame-pointer" "3"
 
# Test 4: filtering
CATEGORY="app-emulation"
PN="wine"
SLOT="0"
NCC="gcc" check "gcc" "-march=native -O2" "4"
 
# Test 5: static variables
CATEGORY="dev-foo"
PN="bar"
SLOT="0"
 
source ./bashrc
if [[ $CHOST == "i686-pc-linux-gnu" ]]; then
echo "Test 5: success"
else
echo "Test 5: failure"
echo "CHOST="${CHOST}""
fi
 
# Clean up temporary files
for i in /tmp/paludisbashrc-*; do
if [[ $(file -b $i) == 'very short file (no magic)' ]]; then
rm $i
fi
done