blob: c98015434e0b0a1c59e28a075a5cd575bb978c16 (
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
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
|
#!/bin/bash
function fail
{
echo "*** Failure at line $1"
exit 1
}
function ctor
{
echo "*** Running: ./ctor $*"
./ctor $*
}
# Wipe the board
rm -Rf build
rm -f configuration.cc
rm -f ctor
cp ctor_files/ctor.cc.base ctor.cc
# Compile bootstrap binary
g++ -pthread -std=c++20 -L../../build -lctor -I../../src ctor.cc -o ctor || fail ${LINENO}
# No build files should have been created yet
[ -d build ] && fail ${LINENO}
# capture md5 sum of ctor binary before configure is called
MD5=`md5sum ctor`
ctor configure --ctor-includedir ../../src --ctor-libdir ../../build
# ctor should be rebuilt at this point, so md5 sum should have changed
(echo $MD5 | md5sum --status -c) && fail ${LINENO}
# configuration.cc should have been generated now
[ ! -f configuration.cc ] && fail ${LINENO}
# Shouldn't compile anything yet - only configure
[ -f build/hello-hello_cc.o ] && fail ${LINENO}
MD5=`md5sum ctor`
# Run normally to build project
ctor -v
# Compiled object should now exist
[ ! -f build/hello-hello_cc.o ] && fail ${LINENO}
# ctor should not have been rebuilt, so md5 sum should be the same
(echo $MD5 | md5sum --status -c) || fail ${LINENO}
MOD1=`stat -c %Y build/hello-hello_cc.o`
touch hello.cc
sleep 1.1
# Run normally to rebuild hello.cc
ctor -v
# Object file should have been recompiled
MOD2=`stat -c %Y build/hello-hello_cc.o`
[[ $MOD1 == $MOD2 ]] && fail ${LINENO}
# Replacve -DFOO with -DBAR in foo external.cxxflags
cp ctor_files/ctor.cc.bar ctor.cc
MD5C=`md5sum configuration.cc`
MD5=`md5sum ctor`
MOD1=`stat -c %Y build/hello-hello_cc.o`
sleep 1.1
# Run normally to reconfigure, rebuild ctor and rebuild hello.cc
ctor -v
MOD2=`stat -c %Y build/hello-hello_cc.o`
[[ $MOD1 == $MOD2 ]] && fail ${LINENO}
(echo $MD5C | md5sum --status -c) && fail ${LINENO}
(echo $MD5 | md5sum --status -c) && fail ${LINENO}
cp ctor_files/ctor.cc.multi ctor.cc
MD5C=`md5sum configuration.cc`
MD5=`md5sum ctor`
MOD1=`stat -c %Y build/hello-hello_cc.o`
sleep 1.1
# Run normally to reconfigure, rebuild ctor and rebuild hello.cc
ctor -v
MOD2=`stat -c %Y build/hello-hello_cc.o`
[[ $MOD1 == $MOD2 ]] && fail ${LINENO}
(echo $MD5C | md5sum --status -c) && fail ${LINENO}
(echo $MD5 | md5sum --status -c) && fail ${LINENO}
# now touching foobar.h, should retrigger re-configuration
touch foobar.h
MOD1=`stat -c %Y ctor`
sleep 1.1
# Run normally to reconfigure, rebuild ctor and rebuild hello.cc
ctor -v
MOD2=`stat -c %Y ctor`
[[ $MOD1 == $MOD2 ]] && fail ${LINENO}
|