Megatest

Diff
Login

Differences From Artifact [2a43e569cb]:

To Artifact [ac31ce093c]:


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
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
131
132
133
134
135

136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158







-
-
+
+



-
+









+
+












-
+

+
+
-
+
-
-
+






+
+
+
+
+
+
+
+
+
+
+




+










+
+

-
+

-
+








-
-
+
+

+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+













-













-
+

+







# 
#     You should have received a copy of the GNU General Public License
#     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.

# make install CSCOPTS='-accumulate-profile -profile-name $(PWD)/profile-ww$(shell date +%V.%u)'
# rm <files>.o ; make install CSCOPTS='-profile' ; ... ;  chicken-profile | less
SHELL=/bin/bash
PREFIX=$(PWD)
CSCOPTS=
PREFIX=$(PWD)/tmpinstall

INSTALL=install
SRCFILES = common.scm items.scm launch.scm \
   ods.scm runconfig.scm server.scm \
   db.scm keys.scm margs.scm megatest-version.scm \
   db.scm keys.scm megatest-version.scm \
   process.scm runs.scm tasks.scm tests.scm genexample.scm \
   http-transport.scm filedb.scm tdb.scm \
   client.scm mt.scm \
   ezsteps.scm lock-queue.scm sdb.scm \
   rmt.scm api.scm subrun.scm \
   portlogger.scm archive.scm env.scm diff-report.scm cgisetup/models/pgdb.scm

# module source files
MSRCFILES = ftail.scm
#  mtcommon.scm mtdb.scm mtconfigf.scm


# Eggs to install (straightforward ones)
EGGS=matchable readline apropos base64 regex-literals format regex-case test coops trace csv \
dot-locking posix-utils posix-extras directory-utils hostinfo tcp-server rpc csv-xml fmt \
json md5 awful http-client spiffy uri-common intarweb spiffy-request-vars \
spiffy-directory-listing ssax sxml-serializer sxml-modifications iup canvas-draw sqlite3

GUISRCF  = dashboard-context-menu.scm dashboard-tests.scm dashboard-guimonitor.scm gutils.scm dcommon.scm tree.scm vg.scm

OFILES   = $(SRCFILES:%.scm=%.o)
GOFILES  = $(GUISRCF:%.scm=%.o)

MOFILES = $(addprefix mofiles/,$(MSRCFILES:%.scm=%.o))
MOFILES = $(MSRCFILES:%.scm=%.o)

CHICKEN_NUMBER = $(shell csi -e '(print (car (reverse (string-split  (repository-path) "/"))))')

mofiles/%.o : %.scm
%.o : %.scm ../adat.scm $(MTEGGS)
	mkdir -p mofiles
	csc $(CSCOPTS) -J -c $< -o mofiles/$*.o
	csc $(CSCOPTS) -J -c $< -o $*.o

ADTLSCR=mt_laststep mt_runstep mt_ezstep
HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR))
DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR))
MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}')

MT_EGGS_BASE=$(PREFIX)/eggs
MT_EGGS_DIR=$(MT_EGGS_BASE)/lib/chicken/$(CHICKEN_NUMBER)
MTEGGS=$(MT_EGGS_DIR)/mtconfigf.so $(MT_EGGS_DIR)/mtdebug.so $(MT_EGGS_DIR)/mtargs.so
CHICKEN_REPOSITORY=$(MT_EGGS_DIR)
export CHICKEN_REPOSITORY
#CSCOPTS=-Wl,-rpath,$(MT_EGGS_DIR)


# prefix commands with $(withenv) following as a means to collect env vars for compilation...
withenv=CHICKEN_REPOSITORY=$(MT_EGGS_DIR) 

ifeq ($(MTESTHASH),)
$(error MTESTHASH is broken!)
endif

CKREPOSITORY=$(shell chicken-install -repository)
CSIPATH=$(shell which csi)
CKPATH=$(shell dirname $(shell dirname $(CSIPATH)))
# ARCHSTR=$(shell uname -m)_$(shell uname -r)
# BASH_MACHTYPE=$(shell bash -c "echo \$$MACHTYPE")
# ARCHSTR=$(BASH_MACHTYPE)_$(shell lsb_release -sr)
ARCHSTR=$(shell if [[ -e /usr/bin/sw_vers ]]; then /usr/bin/sw_vers -productVersion; else lsb_release -sr; fi)
# ARCHSTR=$(shell bash -c "echo \$$MACHTYPE")

PNGFILES = $(shell cd docs/manual;ls *png)

$(MOFILES): $(MTEGGS) $(MT_EGGS_DIR)/types.db

#all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut ndboard
all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut
all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut eggs

mtest: $(OFILES) readline-fix.scm megatest.o $(MOFILES) mofiles/ftail.o
mtest: $(OFILES) readline-fix.scm megatest.o $(MOFILES) $(MTEGGS)
	csc $(CSCOPTS) $(OFILES) $(MOFILES) megatest.o -o mtest

showmtesthash:
	@echo $(MTESTHASH)

dboard : $(OFILES) $(GOFILES) dashboard.scm $(MOFILES)
	csc $(CSCOPTS) $(OFILES) dashboard.scm $(GOFILES) $(MOFILES) -o dboard

ndboard : newdashboard.scm $(OFILES) $(GOFILES)
	csc $(CSCOPTS) $(OFILES) $(GOFILES) newdashboard.scm -o ndboard
mtut: $(OFILES) $(MOFILES) megatest-fossil-hash.scm mtut.scm
	csc $(CSCOPTS) $(OFILES) $(MOFILES) mtut.scm -o mtut

eggs: $(MTEGGS)
mtut: $(OFILES) megatest-fossil-hash.scm mtut.scm
	csc $(CSCOPTS) $(OFILES) mtut.scm -o mtut


# Needed only for adat.scm
OPENSRC_DIR=../opensrc
MTUTILS_DIR=$(OPENSRC_DIR)/mtutils
../adat.scm :  $(MTUTILS_DIR)/adat.scm
	ln -sf $(PWD)/$< $@

# # stuff for handling external files from opensrc package
# mtcommon.scm : $(MTUTILS_DIR)/mtcommon/mtcommon.scm
# 	ln -sf $< $@
# 
# mtdb.scm : $(MTUTILS_DIR)/mtdb/mtdb.scm
# 	ln -sf $< $@
# 
# mtconfigf.scm : $(MTUTILS_DIR)/mtconfigf/mtconfigf.scm 
# 	ln -sf $< $@
# 
TCMTOBJS = \
	api.o \
	archive.o \
	cgisetup/models/pgdb.o \
	client.o \
	common.o \
	db.o \
	env.o \
	http-transport.o \
	items.o \
	keys.o \
	launch.o \
	lock-queue.o \
	margs.o \
	mt.o \
	megatest-version.o \
	ods.o \
	portlogger.o \
	process.o \
	rmt.o \
	rpc-transport.o \
	runconfig.o \
	runs.o \
	server.o \
	tasks.o \
	tdb.o \
	tests.o \
	subrun.o \
	subrun.o

#	mtconfigf.o

tcmt : $(TCMTOBJS) tcmt.scm
	csc $(CSCOPTS) $(TCMTOBJS) tcmt.scm -o tcmt

# install documentation to $(PREFIX)/docs
# DOES NOT REBUILD DOCS
#
134
135
136
137
138
139
140




141
142







143


144
145
146





147




148






149
150
151
152
153
154
155
156
157


158
159
160
161
162
163
164
165
166
167

168

169

170
171
172
173
174
175
176
166
167
168
169
170
171
172
173
174
175
176


177
178
179
180
181
182
183
184
185
186



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210


211
212
213
214
215
216
217
218
219
220
221

222
223
224

225
226
227
228
229
230
231
232







+
+
+
+
-
-
+
+
+
+
+
+
+

+
+
-
-
-
+
+
+
+
+

+
+
+
+

+
+
+
+
+
+







-
-
+
+









-
+

+
-
+







	mkdir -p $(PREFIX)/share/js
	fossil wiki export java-script-lib > $(PREFIX)/share/js/jquery-3.1.0.slim.min.js

$(PREFIX)/share/db/mt-pg.sql : mt-pg.sql
	mkdir -p $(PREFIX)/share/db
	$(INSTALL) mt-pg.sql $(PREFIX)/share/db/mt-pg.sql

# setup the eggs dir in $PREFIX
#
$(MT_EGGS_DIR) :
	mkdir -p $(MT_EGGS_DIR)
#multi-dboard : multi-dboard.scm $(OFILES) $(GOFILES)
#	csc $(CSCOPTS) $(OFILES) $(GOFILES) multi-dboard.scm -o multi-dboard

$(MT_EGGS_DIR)/types.db : $(MT_EGGS_DIR)
	cp -rsf $(CKREPOSITORY)/ $(MT_EGGS_BASE)/lib/chicken/

#	chicken-install -init $(MT_EGGS_DIR)
csi:
	csi

$(MT_EGGS_DIR)/mtargs.so : $(MT_EGGS_DIR)/types.db $(MTUTILS_DIR)/mtargs/mtargs.scm
	cd $(MTUTILS_DIR)/mtargs && chicken-install -prefix $(MT_EGGS_BASE)
# 
# $(PREFIX)/bin/revtagfsl : utils/revtagfsl.scm
#	csc utils/revtagfsl.scm -o $(PREFIX)/bin/revtagfsl


$(MT_EGGS_DIR)/mtdebug.so : $(MT_EGGS_DIR)/types.db $(MTUTILS_DIR)/mtdebug/mtdebug.scm $(MT_EGGS_DIR)/mtargs.so
	cd $(MTUTILS_DIR)/mtdebug && chicken-install -prefix $(MT_EGGS_BASE)


$(MT_EGGS_DIR)/mtconfigf.so : $(MT_EGGS_DIR)/types.db $(MTUTILS_DIR)/mtconfigf/mtconfigf.scm $(MT_EGGS_DIR)/mtdebug.so
	cd $(MTUTILS_DIR)/mtconfigf && chicken-install -prefix $(MT_EGGS_BASE)

#
# Special dependencies for the includes
#

# anything that depends on the special MOFILES needs to be listed on the left here
launch.o : $(MOFILES)
# mtconfigf.o : $(MTUTILS_DIR)/mtconfigf/mtconfigf.scm

tests.o db.o launch.o runs.o dashboard-tests.o dashboard-context-menu.o dashboard-guimonitor.o dashboard-main.o monitor.o dashboard.o  \
archive.o megatest.o : db_records.scm
tests.o runs.o dashboard.o dashboard-tests.o dashboard-context-menu.o dashboard-main.o  : run_records.scm
db.o ezsteps.o keys.o launch.o megatest.o monitor.o runs-for-ref.o runs.o tests.o : key_records.scm
tests.o tasks.o dashboard-tasks.o : task_records.scm
runs.o : test_records.scm
megatest.o : megatest-fossil-hash.scm
rmt.scm client.scm common.scm dashboard-guimonitor.scm dashboard-tests.scm dashboard.scm db.scm dcommon.scm ezsteps.scm fs-transport.scm http-transport.scm index-tree.scm items.scm keys.scm launch.scm megatest.scm monitor.scm mt.scm newdashboard.scm runconfig.scm runs.scm server.scm tdb.scm tests.scm tree.scm : common_records.scm
common_records.scm : altdb.scm
rmt.scm client.scm common.scm dashboard-guimonitor.scm dashboard-tests.scm dashboard.scm db.scm dcommon.scm ezsteps.scm fs-transport.scm http-transport.scm index-tree.scm items.scm keys.scm launch.scm megatest.scm monitor.scm mt.scm newdashboard.scm runconfig.scm runs.scm server.scm tdb.scm tests.scm tree.scm : common_records.scm $(MTEGGS) $(MT_EGGS_DIR)/types.db
common_records.scm : altdb.scm modules.scm 
vg.o dashboard.o : vg_records.scm
dcommon.o : run_records.scm
# Temporary while transitioning to new routine
# runs.o : run-tests-queue-classic.scm  run-tests-queue-new.scm

megatest-fossil-hash.scm : $(SRCFILES) megatest.scm *_records.scm
	echo "(define megatest-fossil-hash \"$(MTESTHASH)\")" > megatest-fossil-hash.new
	if ! diff -q megatest-fossil-hash.new megatest-fossil-hash.scm ; then echo copying .new to .scm;cp -f megatest-fossil-hash.new megatest-fossil-hash.scm;fi

$(OFILES) $(GOFILES) : common_records.scm 
$(OFILES) $(GOFILES) : common_records.scm modules.scm

# TODO: make modules.scm changes trigger rebuild. modules.scm in following recipe does not work.
%.o : %.scm
%.o : %.scm modules.scm
	csc $(CSCOPTS) -c $<

$(PREFIX)/bin/.$(ARCHSTR)/mtest : mtest utils/mk_wrapper
	@echo Installing to PREFIX=$(PREFIX)
	$(INSTALL) mtest $(PREFIX)/bin/.$(ARCHSTR)/mtest
	utils/mk_wrapper $(PREFIX) mtest $(PREFIX)/bin/megatest
	chmod a+x $(PREFIX)/bin/megatest
264
265
266
267
268
269
270


271
272
273
274
275
276
277
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335







+
+








$(PREFIX)/bin/mtest-reaper: helpers/mtest-reaper.scm helpers/ducttape-lib.scm helpers/inteldate.scm helpers/mimetypes.scm
	make -C helpers $@ PREFIX=$(PREFIX) INSTALL=$(INSTALL) ARCHSTR=$(ARCHSTR)

mtest-reaper: $(PREFIX)/bin/mtest-reaper

# install dashboard as dboard so wrapper script can be called dashboard
# NOTE: Should be able to add something like -Wl,'$ORIGIN/../lib' to find IUP libs
#
$(PREFIX)/bin/.$(ARCHSTR)/dboard : dboard $(FILES) utils/mk_wrapper
	utils/mk_wrapper $(PREFIX) dboard $(PREFIX)/bin/dashboard
	chmod a+x $(PREFIX)/bin/dashboard
	$(INSTALL) dboard $(PREFIX)/bin/.$(ARCHSTR)/dboard

install : $(PREFIX)/bin/.$(ARCHSTR) $(PREFIX)/bin/.$(ARCHSTR)/mtest $(PREFIX)/bin/megatest \
          $(PREFIX)/bin/.$(ARCHSTR)/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake \
295
296
297
298
299
300
301
302





303
304
305
306
307
308
309
353
354
355
356
357
358
359

360
361
362
363
364
365
366
367
368
369
370
371







-
+
+
+
+
+







	mkdir -p ext-tests
	cd ext-tests;fossil open --nested $(MTQA_FOSSIL)

$(MTQA_FOSSIL) :
	fossil clone https://www.kiatoa.com/fossils/megatest_qa $(MTQA_FOSSIL)

clean : 
	rm -f $(OFILES) $(GOFILES) $(MOFILES) $(TCMTOBJS) $(PREFIX)/megatest $(PREFIX)/dashboard mtest mtutil dboard dboard.o megatest.o dashboard.o megatest-fossil-hash.* altdb.scm mofiles/*.o vg.o
	rm -f $(OFILES) $(GOFILES) $(MOFILES) $(TCMTOBJS) $(PREFIX)/megatest \
        $(PREFIX)/dashboard mtest mtutil dboard dboard.o megatest.o dashboard.o \
        megatest-fossil-hash.* altdb.scm mofiles/*.o vg.o mtut.o \
	*.import.scm mofiles/*.import.scm *.bak *~ *-original *-merge *-baseline \
        rm -rf $(PREFIX)/*

#======================================================================
# Make the records files
#======================================================================

# vg_records.scm : records.sh
#	./records.sh
340
341
342
343
344
345
346
347

348
349
350

351
352
353
354
355
356
357
358
359
360


361
362
363


364
365
366
367


368
369
370
371
372
373
374
402
403
404
405
406
407
408

409
410
411

412
413
414
415
416
417
418
419
420


421
422
423


424
425
426
427


428
429
430
431
432
433
434
435
436







-
+


-
+








-
-
+
+

-
-
+
+


-
-
+
+








deploytarg/dboard :  $(OFILES) $(GOFILES) dashboard.scm deploytarg/apropos.so
	csc -deploy $(OFILES) $(GOFILES) dashboard.scm -o deploytarg
	mv deploytarg/deploytarg deploytarg/dboard

# DATASHAREO=common.o process.o tree.o dcommon.o margs.o launch.o gutils.o db.o synchash.o server.o \
#            megatest-version.o tdb.o ods.o mt.o keys.o
datashare-testing/sd : datashare.scm $(OFILES)
datashare-testing/sd : datashare.scm $(OFILES) modules.scm
	csc $(CSCOPTS) datashare.scm $(OFILES) -o datashare-testing/sd

datashare-testing/sdat: sharedat.scm $(OFILES)
datashare-testing/sdat: sharedat.scm $(OFILES) modules.scm
	csc $(CSCOPTS) sharedat.scm $(OFILES) -o datashare-testing/sdat

sd : datashare-testing/sd
	mkdir -p /tmp/$(USER)/datashare/disk1 /tmp/$(USER)/basepath

xterm : sd
	(export BASEPATH=/tmp/$(USER)/basepath ; export PATH="$(PWD)/datashare-testing:$(PATH)" ; xterm &)

datashare-testing/spublish : spublish.scm $(OFILES)
	csc $(CSCOPTS) spublish.scm  megatest-version.o margs.o process.o common.o  -o datashare-testing/spublish
datashare-testing/spublish : spublish.scm $(OFILES) modules.scm
	csc $(CSCOPTS) spublish.scm  megatest-version.o  process.o common.o  -o datashare-testing/spublish

datashare-testing/sretrieve : sretrieve.scm $(OFILES)
	csc $(CSCOPTS) sretrieve.scm  megatest-version.o margs.o process.o common.o  -o datashare-testing/sretrieve
datashare-testing/sretrieve : sretrieve.scm $(OFILES) modules.scm
	csc $(CSCOPTS) sretrieve.scm  megatest-version.o process.o common.o  -o datashare-testing/sretrieve


datashare-testing/sauthorize : sauthorize.scm $(OFILES)
	 csc $(CSCOPTS) sauthorize.scm  megatest-version.o margs.o process.o common.o  -o datashare-testing/sauthorize
datashare-testing/sauthorize : sauthorize.scm $(OFILES) modules.scm
	 csc $(CSCOPTS) sauthorize.scm  megatest-version.o process.o common.o  -o datashare-testing/sauthorize

sauth-init:
	mkdir -p  datashare-testing
	rm  datashare-testing/sauthorize
	rm  datashare-testing/sretrieve 
	rm  datashare-testing/spublish

394
395
396
397
398
399
400
401
402


403
404
405
406
407
408
409
456
457
458
459
460
461
462


463
464
465
466
467
468
469
470
471







-
-
+
+







	if  csi -ne '(use mysql-client)';then \
           echo "(use mysql-client)(hash-table-set! *available-db* 'mysql #t)" >> altdb.scm; \
	fi
	if csi -ne '(use postgresql)';then \
	   echo "(use postgresql)(hash-table-set! *available-db* 'postgresql #t)" >> altdb.scm;\
	fi

portlogger-example : portlogger-example.scm api.o archive.o client.o common.o dashboard-tests.o dashboard-context-menu.o db.o dcommon.o ezsteps.o filedb.o genexample.o gutils.o http-transport.o items.o keys.o launch.o lock-queue.o margs.o megatest-version.o mt.o ods.o portlogger.o process.o rmt.o rpc-transport.o runconfig.o runs.o sdb.o server.o synchash.o tasks.o tdb.o tests.o tree.o
	csc $(CSCOPTS) portlogger-example.scm api.o archive.o client.o common.o dashboard-tests.o dashboard-context-menu.o db.o dcommon.o ezsteps.o filedb.o genexample.o gutils.o http-transport.o items.o keys.o launch.o lock-queue.o margs.o megatest-version.o mt.o ods.o portlogger.o process.o rmt.o rpc-transport.o runconfig.o runs.o sdb.o server.o synchash.o tasks.o tdb.o tests.o tree.o
portlogger-example : portlogger-example.scm api.o archive.o client.o common.o dashboard-tests.o dashboard-context-menu.o db.o dcommon.o ezsteps.o filedb.o genexample.o gutils.o http-transport.o items.o keys.o launch.o lock-queue.o megatest-version.o mt.o ods.o portlogger.o process.o rmt.o rpc-transport.o runconfig.o runs.o sdb.o server.o synchash.o tasks.o tdb.o tests.o tree.o
	csc $(CSCOPTS) portlogger-example.scm api.o archive.o client.o common.o dashboard-tests.o dashboard-context-menu.o db.o dcommon.o ezsteps.o filedb.o genexample.o gutils.o http-transport.o items.o keys.o launch.o lock-queue.o megatest-version.o mt.o ods.o portlogger.o process.o rmt.o rpc-transport.o runconfig.o runs.o sdb.o server.o synchash.o tasks.o tdb.o tests.o tree.o

# create a pdf dot graphviz diagram from notations in rmt.scm
rmt.pdf : rmt.scm
	grep ';;DOT' rmt.scm | sed -e 's/.*;;DOT //' > rmt.dot;dot -Tpdf rmt.dot -o rmt.pdf

buildmanual:
	cd docs/manual && make