4 SITEDIR=/etc/planetlab/configs
6 RPM=$(shell ls -rt /root/myplc*rpm | tail -1)
7 APIDIR=/usr/share/plc_api
9 PLC1=lurch.cs.princeton.edu
10 PLC2=planetlab-devbox.inria.fr
17 PUSH=pclean pplc2 papi2 pplc1 papi1
21 papi: pclean papi1 papi2
22 pplc: pclean pplc1 pplc2
25 -find . '(' -name '*.pyc' -o -name '*~' ')' | xargs rm
27 rsync -a -v -C ./ root@$(PLC1):new_plc_api/
29 rsync -a -v -C ./planetlab4.sql ./PLC root@$(PLC1):$(CHROOT)$(APIDIR)/
31 rsync -a -v -C ./ root@$(PLC2):new_plc_api/
33 rsync -a -v -C ./planetlab4.sql ./PLC root@$(PLC2):$(CHROOT)$(APIDIR)/
36 DB=install-schema stop-clients db-drop restart-full-db
37 DBI= stop-clients db-drop restart-db db-restore restart-http
38 WEB=install-api restart
44 @echo Restored $(DBDUMP) on $(shell hostname) at $(shell date)
46 DBDUMP=planetlab4.dump
49 chroot $(CHROOT) pg_dump -c -U pgsqluser planetlab4 > $(DBDUMP)
54 @echo 'installing schema'
55 @rsync -a -v planetlab4.sql $(CHROOT)$(APIDIR)/planetlab4.sql
58 find . -name '*.py' | xargs tar cf - | ( cd $(CHROOT)$(APIDIR) ; tar xf -)
59 -find $(CHROOT)$(APIDIR) -name '*pyc' | xargs rm
64 @echo 'pkilling Shell.py'
67 service plc stop httpd
71 chroot $(CHROOT) psql -U postgres --port $(PORT) template1 -c 'drop database planetlab4'
74 echo Restoring $(DBDUMP)
75 rm -f $(DBDUMP).rest-log $(DBDUMP).rest-err
76 chroot $(CHROOT) psql -U postgres --port $(PORT) -d planetlab4 < $(DBDUMP) > $(DBDUMP).rest-log 2> $(DBDUMP).rest-err
77 ls -l $(DBDUMP).rest-log $(DBDUMP).rest-err
80 @echo 'restarting db only'
81 service plc stop postgresql
82 service plc start postgresql
85 @echo 'restarting full db'
86 service plc stop db postgresql httpd
87 service plc start httpd postgresql db
90 @echo 'Restarting PLC'
91 @chroot $(CHROOT) service plc restart
94 @echo 'Restarting httpd'
95 service plc stop httpd
96 service plc start httpd
99 UPGRADE=stop-clients down clean-plc up reconfig restart
104 @echo latest rpm is $(RPM)
107 cp $(SITEDIR)/$(SITE) .
117 cp $(SITE) $(SITEDIR)
118 (echo w; echo q) | chroot $(CHROOT) plc-config-tty
123 chroot $(CHROOT) /usr/share/plc_api/Shell.py
126 chroot $(CHROOT) psql -U pgsqluser planetlab4
129 emacs /plc/data/var/log/httpd/error_log /plc/data/var/log/boot.log
132 # remove time/delay dependent output
133 normalize = egrep -v "'expires':|^+++.*ellapsed"
135 TEST=run checkpoint diff
137 normalize: TestPeers-n.nout TestPeers-n.nref
140 $(normalize) $*.out > $@
142 $(normalize) $*.ref > $@
146 diff TestPeers-n.ref TestPeers-n.out
149 @echo adopting latest run as reference
150 cp TestPeers-n.out TestPeers-n.ref
151 rm -f TestPeers-n.n???
156 VARIANT-TESTS += run-n
158 python -u ./TestPeers.py > TestPeers-n.out 2>&1
159 VARIANT-TESTS += run-m
161 python -u ./TestPeers.py -m > TestPeers-m.out 2>&1
162 VARIANT-TESTS += run-b
164 python -u ./TestPeers.py -b > TestPeers-b.out 2>&1
165 VARIANT-TESTS += run-p run-pn
167 python -u ./TestPeers.py -p > TestPeers-p.out 2>&1
168 VARIANT-TESTS += run-pb
170 python -u ./TestPeers.py -p -b > TestPeers-pb.out 2>&1
171 VARIANT-TESTS += run-ph
173 python -u ./TestPeers.py -p -H > TestPeers-ph.out 2>&1
174 VARIANT-TESTS += run-e run-en
176 python -u ./TestPeers.py -e > TestPeers-e.out 2>&1
177 VARIANT-TESTS += run-eb
179 python -u ./TestPeers.py -e -b > TestPeers-eb.out 2>&1
180 VARIANT-TESTS += run-eh
182 python -u ./TestPeers.py -e -H > TestPeers-eh.out 2>&1
184 VARIANT-TESTS += diff-m
185 diff-m: TestPeers-m.nref TestPeers-m.nout
186 diff TestPeers-m.nref TestPeers-m.nout
187 VARIANT-TESTS += ckp-m
189 cp TestPeers-m.out TestPeers-m.ref
190 rm -f TestPeers-m.n???
192 VARIANT-TESTS += diff-p
193 diff-p: TestPeers-p.nref TestPeers-p.nout
194 diff TestPeers-p.nref TestPeers-p.nout
195 VARIANT-TESTS += ckp-p
197 cp TestPeers-p.out TestPeers-p.ref
198 rm -f TestPeers-p.n???
211 save-n: DB1=populate-n-1.sql
212 save-n: DB2=populate-n-2.sql
216 save-b: DB1=populate-b-1.sql
217 save-b: DB2=populate-b-2.sql
221 save-h: DB1=populate-h-1.sql
222 save-h: DB2=populate-h-2.sql
226 ssh $(PLC1SSH) "make -C new_plc_api -f peers-test.mk DBDUMP=$(DB1) db-dump"
227 scp $(PLC1SSH):new_plc_api/$(DB1) .
229 ssh $(PLC2SSH) "make -C new_plc_api -f peers-test.mk DBDUMP=$(DB2) db-dump"
230 scp $(PLC2SSH):new_plc_api/$(DB2) .
232 RESTORE=restore1 restore2
233 VARIANT-DB += restore
236 VARIANT-DB += restore-n
237 restore-n: DB1=populate-n-1.sql
238 restore-n: DB2=populate-n-2.sql
241 VARIANT-DB += restore-b
242 restore-b: DB1=populate-b-1.sql
243 restore-b: DB2=populate-b-2.sql
246 VARIANT-DB += restore-h
247 restore-h: DB1=populate-h-1.sql
248 restore-h: DB2=populate-h-2.sql
252 scp $(DB1) $(PLC1SSH):new_plc_api/
253 ssh $(PLC1SSH) "make -C new_plc_api -f peers-test.mk DBDUMP=$(DB1) dbi"
255 scp $(DB2) $(PLC2SSH):new_plc_api/
256 ssh $(PLC2SSH) "make -C new_plc_api -f peers-test.mk DBDUMP=$(DB2) dbi"
259 HELP=rpm db-dump restart-http
268 @echo upgrade: $(UPGRADE)
270 @echo other test targets: $(VARIANT-TESTS)
272 @echo restore:$(RESTORE)
273 @echo db targets: $(VARIANT-DB)
274 @echo OTHERS: $(HELP)