Megatest

Check-in [b28d552c97]
Login
Overview
Comment:yada
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-multi-db
Files: files | file ages | folders
SHA1: b28d552c97adc2d965ab7babf7c890e56e4eb4ce
User & Date: matt on 2019-02-04 23:07:02
Other Links: branch diff | manifest | tags
Context
2019-02-05
18:51
Added server:whoami? and make the server signature a pair and not a string. check-in: e0622d9f3d user: mrwellan tags: v1.65-multi-db
2019-02-04
23:07
yada check-in: b28d552c97 user: matt tags: v1.65-multi-db
05:17
Added missing files. check-in: 366547935e user: matt tags: v1.65-multi-db
Changes

Modified Makefile from [ab612ddd72] to [28c4911343].

24
25
26
27
28
29
30
31

32
33
34
35

36
37
38

39
40
41
42
43
44
45
24
25
26
27
28
29
30

31
32
33
34

35
36
37

38
39
40
41
42
43
44
45







-
+



-
+


-
+







SRCFILES = common.scm items.scm launch.scm \
   ods.scm runconfig.scm configf.scm \
   keys.scm margs.scm server.o 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 \
   rmt.scm api.scm subrun.scm \
   rmt.scm subrun.scm \
   archive.scm env.scm diff-report.scm cgisetup/models/pgdb.scm 

# module source files
MSRCFILES = ftail.scm portlogger.scm nmsg-transport.scm db.scm
MSRCFILES = ftail.scm portlogger.scm nmsg-transport.scm db.scm api.scm

# files needed for mtserve
MTSERVEFILES = common.scm megatest-version.scm margs.scm server.scm keys.scm ods.scm
MTSERVEFILES = common.scm megatest-version.scm margs.scm server.scm keys.scm ods.scm rmt.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

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
91
92
93
94
95
96
97

98
99
100
101
102
103
104







-







ndboard : newdashboard.scm $(OFILES) $(GOFILES)
	csc $(CSCOPTS) $(OFILES) $(GOFILES) newdashboard.scm -o ndboard

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

TCMTOBJS = \
	api.o \
	archive.o \
	cgisetup/models/pgdb.o \
	client.o \
	common.o \
	configf.o \
	env.o \
	http-transport.o \
117
118
119
120
121
122
123

124
125
126
127
128
129
130
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130







+







	runs.o \
	server.o \
	tasks.o \
	tdb.o \
	tests.o \
	subrun.o \
 
#	api.o \
#	db.o \
#	rpc-transport.o \
#	portlogger.o \

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

Modified db.scm from [cabfa359a4] to [095da180ef].

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
































































































































































































































































































































































































































































































491
492
493
494
495
496
497
324
325
326
327
328
329
330
































































































































































331
332
333
334
335
336
337
338
339
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817







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







                              state        TEXT DEFAULT 'new',
                              status       TEXT DEFAULT 'n/a',
                              archive_type TEXT DEFAULT 'bup',
                              du           INTEGER,
                              archive_path TEXT);")))
     db)

(define (db:general-sqlite-error-dump . args) #t)
(define (db:first-result-default . args) #t)
(define (db:get-db . args) #t)
(define (db:dbdat-get-db . args) #t)
(define (db:dbdat-get-path . args) #t)
(define (db:with-db . args) #t)
(define (db:set-sync . args) #t)
(define (db:lock-create-open . args) #t)
(define (db:open-db . args) #t)
(define (db:get-last-update-time . args) #t)
(define (db:setup . args) #t)
(define (db:open-megatest-db . args) #t)
(define (db:sync-touched . args) #t)
(define (db:safely-close-sqlite3-db . args) #t)
(define (db:close-all . args) #t)
(define (db:sync-main-list . args) #t)
(define (db:sync-all-tables-list . args) #t)
(define (db:move-and-recreate-db . args) #t)
(define (db:repair-db . args) #t)
(define (db:sync-tables . args) #t)
(define (db:patch-schema-rundb . args) #t)
(define (db:patch-schema-maindb . args) #t)
(define (db:adj-target . args) #t)
(define (db:get-access-mode . args) #t)
(define (db:dispatch-query . args) #t)
(define (db:cache-for-read-only . args) #t)
(define (db:multi-db-sync . args) #t)
(define (db:tmp->megatest.db-sync . args) #t)
(define (db:sync-to-megatest.db . args) #t)
(define (open-run-close-no-exception-handling . args) #t)
(define (open-run-close-exception-handling . args) #t)
(define (db:initialize-main-db . args) #t)
(define (db:archive-get-allocations . args) #t)
(define (db:archive-register-disk . args) #t)
(define (db:archive-register-block-name . args) #t)
(define (db:test-set-archive-block-id . args) #t)
(define (db:test-get-archive-block-info . args) #t)
(define (open-logging-db . args) #t)
(define (db:log-local-event . args) #t)
(define (db:log-event . args) #t)
(define (db:have-incompletes? . args) #t)
(define (db:find-and-mark-incomplete . args) #t)
(define (db:top-test-set-per-pf-counts . args) #t)
(define (db:clean-up . args) #t)
(define (db:clean-up-rundb . args) #t)
(define (db:clean-up-maindb . args) #t)
(define (db:get-var . args) #t)
(define (db:set-var . args) #t)
(define (db:del-var . args) #t)
(define (db:open-no-sync-db . args) #t)
(define (db:no-sync-db . args) #t)
(define (db:no-sync-set . args) #t)
(define (db:no-sync-del! . args) #t)
(define (db:no-sync-get/default . args) #t)
(define (db:no-sync-close-db . args) #t)
(define (db:no-sync-get-lock . args) #t)
(define (db:get-keys . args) #t)
(define (db:get-value-by-header . args) #t)
(define (db:get-header . args) #t)
(define (db:get-rows . args) #t)
(define (db:get-run-times . args) #t)
(define (db:get-run-name-from-id . args) #t)
(define (db:get-run-key-val . args) #t)
(define (runs:get-std-run-fields . args) #t)
(define (db:patt->like . args) #t)
(define (db:register-run . args) #t)
(define (db:get-runs . args) #t)
(define (db:simple-get-runs . args) #t)
(define (db:get-changed-run-ids . args) #t)
(define (db:get-targets . args) #t)
(define (db:get-num-runs . args) #t)
(define (db:get-runs-cnt-by-patt . args) #t)
(define (db:get-raw-run-stats . args) #t)
(define (db:update-run-stats . args) #t)
(define (db:get-main-run-stats . args) #t)
(define (db:print-current-query-stats . args) #t)
(define (db:get-all-run-ids . args) #t)
(define (db:get-run-stats . args) #t)
(define (db:get-runs-by-patt . args) #t)
(define (db:get-run-info . args) #t)
(define (db:set-comment-for-run . args) #t)
(define (db:delete-run . args) #t)
(define (db:update-run-event_time . args) #t)
(define (db:lock/unlock-run . args) #t)
(define (db:set-run-status . args) #t)
(define (db:get-run-status . args) #t)
(define (db:get-key-val-pairs . args) #t)
(define (db:get-key-vals . args) #t)
(define (db:get-target . args) #t)
(define (db:get-prev-run-ids . args) #t)
(define (db:get-tests-for-run . args) #t)
(define (db:test-short-record->norm . args) #t)
(define (db:get-tests-for-run-state-status . args) #t)
(define (db:get-testinfo-state-status . args) #t)
(define (db:get-tests-for-run-mindata . args) #t)
(define (db:get-tests-for-runs . args) #t)
(define (db:delete-test-records . args) #t)
(define (db:delete-old-deleted-test-records . args) #t)
(define (db:set-tests-state-status . args) #t)
(define (db:test-set-state-status . args) #t)
(define (db:get-count-tests-running . args) #t)
(define (db:get-count-tests-actually-running . args) #t)
(define (db:get-count-tests-running-for-run-id . args) #t)
(define (db:get-count-tests-running-for-testname . args) #t)
(define (db:get-count-tests-running-in-jobgroup . args) #t)
(define (db:estimated-tests-remaining . args) #t)
(define (db:get-test-id . args) #t)
(define (db:test-set-top-process-pid . args) #t)
(define (db:test-get-top-process-pid . args) #t)
(define (db:field->number . args) #t)
(define (db:get-all-tests-info-by-run-id . args) #t)
(define (db:replace-test-records . args) #t)
(define (db:adj-test-id . args) #t)
(define (db:prep-megatest.db-adj-test-ids . args) #t)
(define (db:prep-megatest.db-for-migration . args) #t)
(define (db:get-test-info-by-id . args) #t)
(define (db:get-test-info-by-ids . args) #t)
(define (db:get-test-info . args) #t)
(define (db:test-get-rundir-from-test-id . args) #t)
(define (db:get-test-times . args) #t)
(define (db:get-test-times . args) #t)
(define (db:teststep-set-status! . args) #t)
(define (db:get-steps-for-test . args) #t)
(define (db:get-steps-info-by-id . args) #t)
(define (db:get-steps-data . args) #t)
(define (db:get-data-info-by-id . args) #t)
(define (db:test-data-rollup . args) #t)
(define (db:logpro-dat->csv . args) #t)
(define (db:csv->test-data . args) #t)
(define (db:read-test-data . args) #t)
(define (db:read-test-data* . args) #t)
(define (db:get-run-ids-matching-target . args) #t)
(define (db:test-get-paths-matching-keynames-target-new . args) #t)
(define (db:test-toplevel-num-items . args) #t)
(define (db:obj->string . args) #t)
(define (db:string->obj . args) #t)
(define (db:set-state-status-and-roll-up-items . args) #t)
(define (db:get-all-state-status-counts-for-test . args) #t)
(define (db:test-get-logfile-info . args) #t)
(define (db:lookup-query . args) #t)
(define (db:login . args) #t)
(define (db:general-call . args) #t)
(define (db:get-state-status-summary . args) #t)
(define (db:get-latest-host-load . args) #t)
(define (db:set-top-level-from-items . args) #t)
(define (db:get-matching-previous-test-run-records . args) #t)
(define (db:delay-if-busy . args) #t)
(define (db:test-get-records-for-index-file . args) #t)
(define (db:get-tests-tags . args) #t)
(define (db:testmeta-get-record . args) #t)
(define (db:testmeta-add-record . args) #t)
(define (db:testmeta-update-field . args) #t)
(define (db:testmeta-get-all . args) #t)
(define (db:compare-itempaths . args) #t)
(define (db:convert-test-itempath . args) #t)
(define (db:multi-pattern-apply . args) #t)
(define (db:get-prereqs-not-met . args) #t)
(define (db:get-run-record-ids . args) #t)
(define (db:get-changed-record-ids . args) #t)
(define (db:extract-ods-file . args) #t)
(define (db:general-sqlite-error-dump . args)
  #t
  (print "Got here: db:general-sqlite-error-dump"))
(define (db:first-result-default . args)
  #t
  (print "Got here: db:first-result-default"))
(define (db:get-db . args)
  #t
  (print "Got here: db:get-db"))
(define (db:dbdat-get-db . args)
  #t
  (print "Got here: db:dbdat-get-db"))
(define (db:dbdat-get-path . args)
  #t
  (print "Got here: db:dbdat-get-path"))
(define (db:with-db . args)
  #t
  (print "Got here: db:with-db"))
(define (db:set-sync . args)
  #t
  (print "Got here: db:set-sync"))
(define (db:lock-create-open . args)
  #t
  (print "Got here: db:lock-create-open"))
(define (db:open-db . args)
  #t
  (print "Got here: db:open-db"))
(define (db:get-last-update-time . args)
  #t
  (print "Got here: db:get-last-update-time"))
(define (db:setup . args)
  #t
  (print "Got here: db:setup"))
(define (db:open-megatest-db . args)
  #t
  (print "Got here: db:open-megatest-db"))
(define (db:sync-touched . args)
  #t
  (print "Got here: db:sync-touched"))
(define (db:safely-close-sqlite3-db . args)
  #t
  (print "Got here: db:safely-close-sqlite3-db"))
(define (db:close-all . args)
  #t
  (print "Got here: db:close-all"))
(define (db:sync-main-list . args)
  #t
  (print "Got here: db:sync-main-list"))
(define (db:sync-all-tables-list . args)
  #t
  (print "Got here: db:sync-all-tables-list"))
(define (db:move-and-recreate-db . args)
  #t
  (print "Got here: db:move-and-recreate-db"))
(define (db:repair-db . args)
  #t
  (print "Got here: db:repair-db"))
(define (db:sync-tables . args)
  #t
  (print "Got here: db:sync-tables"))
(define (db:patch-schema-rundb . args)
  #t
  (print "Got here: db:patch-schema-rundb"))
(define (db:patch-schema-maindb . args)
  #t
  (print "Got here: db:patch-schema-maindb"))
(define (db:adj-target . args)
  #t
  (print "Got here: db:adj-target"))
(define (db:get-access-mode . args)
  #t
  (print "Got here: db:get-access-mode"))
(define (db:dispatch-query . args)
  #t
  (print "Got here: db:dispatch-query"))
(define (db:cache-for-read-only . args)
  #t
  (print "Got here: db:cache-for-read-only"))
(define (db:multi-db-sync . args)
  #t
  (print "Got here: db:multi-db-sync"))
(define (db:tmp->megatest.db-sync . args)
  #t
  (print "Got here: db:tmp->megatest.db-sync"))
(define (db:sync-to-megatest.db . args)
  #t
  (print "Got here: db:sync-to-megatest.db"))
(define (open-run-close-no-exception-handling . args)
  #t
  (print "Got here: open-run-close-no-exception-handling"))
(define (open-run-close-exception-handling . args)
  #t
  (print "Got here: open-run-close-exception-handling"))
(define (db:initialize-main-db . args)
  #t
  (print "Got here: db:initialize-main-db"))
(define (db:archive-get-allocations . args)
  #t
  (print "Got here: db:archive-get-allocations"))
(define (db:archive-register-disk . args)
  #t
  (print "Got here: db:archive-register-disk"))
(define (db:archive-register-block-name . args)
  #t
  (print "Got here: db:archive-register-block-name"))
(define (db:test-set-archive-block-id . args)
  #t
  (print "Got here: db:test-set-archive-block-id"))
(define (db:test-get-archive-block-info . args)
  #t
  (print "Got here: db:test-get-archive-block-info"))
(define (open-logging-db . args)
  #t
  (print "Got here: open-logging-db"))
(define (db:log-local-event . args)
  #t
  (print "Got here: db:log-local-event"))
(define (db:log-event . args)
  #t
  (print "Got here: db:log-event"))
(define (db:have-incompletes? . args)
  #t
  (print "Got here: db:have-incompletes?"))
(define (db:find-and-mark-incomplete . args)
  #t
  (print "Got here: db:find-and-mark-incomplete"))
(define (db:top-test-set-per-pf-counts . args)
  #t
  (print "Got here: db:top-test-set-per-pf-counts"))
(define (db:clean-up . args)
  #t
  (print "Got here: db:clean-up"))
(define (db:clean-up-rundb . args)
  #t
  (print "Got here: db:clean-up-rundb"))
(define (db:clean-up-maindb . args)
  #t
  (print "Got here: db:clean-up-maindb"))
(define (db:get-var . args)
  #t
  (print "Got here: db:get-var"))
(define (db:set-var . args)
  #t
  (print "Got here: db:set-var"))
(define (db:del-var . args)
  #t
  (print "Got here: db:del-var"))
(define (db:open-no-sync-db . args)
  #t
  (print "Got here: db:open-no-sync-db"))
(define (db:no-sync-db . args)
  #t
  (print "Got here: db:no-sync-db"))
(define (db:no-sync-set . args)
  #t
  (print "Got here: db:no-sync-set"))
(define (db:no-sync-del! . args)
  #t
  (print "Got here: db:no-sync-del!"))
(define (db:no-sync-get/default . args)
  #t
  (print "Got here: db:no-sync-get/default"))
(define (db:no-sync-close-db . args)
  #t
  (print "Got here: db:no-sync-close-db"))
(define (db:no-sync-get-lock . args)
  #t
  (print "Got here: db:no-sync-get-lock"))
(define (db:get-keys . args)
  #t
  (print "Got here: db:get-keys"))
(define (db:get-value-by-header . args)
  #t
  (print "Got here: db:get-value-by-header"))
(define (db:get-header . args)
  #t
  (print "Got here: db:get-header"))
(define (db:get-rows . args)
  #t
  (print "Got here: db:get-rows"))
(define (db:get-run-times . args)
  #t
  (print "Got here: db:get-run-times"))
(define (db:get-run-name-from-id . args)
  #t
  (print "Got here: db:get-run-name-from-id"))
(define (db:get-run-key-val . args)
  #t
  (print "Got here: db:get-run-key-val"))
(define (runs:get-std-run-fields . args)
  #t
  (print "Got here: runs:get-std-run-fields"))
(define (db:patt->like . args)
  #t
  (print "Got here: db:patt->like"))
(define (db:register-run . args)
  #t
  (print "Got here: db:register-run"))
(define (db:get-runs . args)
  #t
  (print "Got here: db:get-runs"))
(define (db:simple-get-runs . args)
  #t
  (print "Got here: db:simple-get-runs"))
(define (db:get-changed-run-ids . args)
  #t
  (print "Got here: db:get-changed-run-ids"))
(define (db:get-targets . args)
  #t
  (print "Got here: db:get-targets"))
(define (db:get-num-runs . args)
  #t
  (print "Got here: db:get-num-runs"))
(define (db:get-runs-cnt-by-patt . args)
  #t
  (print "Got here: db:get-runs-cnt-by-patt"))
(define (db:get-raw-run-stats . args)
  #t
  (print "Got here: db:get-raw-run-stats"))
(define (db:update-run-stats . args)
  #t
  (print "Got here: db:update-run-stats"))
(define (db:get-main-run-stats . args)
  #t
  (print "Got here: db:get-main-run-stats"))
(define (db:print-current-query-stats . args)
  #t
  (print "Got here: db:print-current-query-stats"))
(define (db:get-all-run-ids . args)
  #t
  (print "Got here: db:get-all-run-ids"))
(define (db:get-run-stats . args)
  #t
  (print "Got here: db:get-run-stats"))
(define (db:get-runs-by-patt . args)
  #t
  (print "Got here: db:get-runs-by-patt"))
(define (db:get-run-info . args)
  #t
  (print "Got here: db:get-run-info"))
(define (db:set-comment-for-run . args)
  #t
  (print "Got here: db:set-comment-for-run"))
(define (db:delete-run . args)
  #t
  (print "Got here: db:delete-run"))
(define (db:update-run-event_time . args)
  #t
  (print "Got here: db:update-run-event_time"))
(define (db:lock/unlock-run . args)
  #t
  (print "Got here: db:lock/unlock-run"))
(define (db:set-run-status . args)
  #t
  (print "Got here: db:set-run-status"))
(define (db:get-run-status . args)
  #t
  (print "Got here: db:get-run-status"))
(define (db:get-key-val-pairs . args)
  #t
  (print "Got here: db:get-key-val-pairs"))
(define (db:get-key-vals . args)
  #t
  (print "Got here: db:get-key-vals"))
(define (db:get-target . args)
  #t
  (print "Got here: db:get-target"))
(define (db:get-prev-run-ids . args)
  #t
  (print "Got here: db:get-prev-run-ids"))
(define (db:get-tests-for-run . args)
  #t
  (print "Got here: db:get-tests-for-run"))
(define (db:test-short-record->norm . args)
  #t
  (print "Got here: db:test-short-record->norm"))
(define (db:get-tests-for-run-state-status . args)
  #t
  (print "Got here: db:get-tests-for-run-state-status"))
(define (db:get-testinfo-state-status . args)
  #t
  (print "Got here: db:get-testinfo-state-status"))
(define (db:get-tests-for-run-mindata . args)
  #t
  (print "Got here: db:get-tests-for-run-mindata"))
(define (db:get-tests-for-runs . args)
  #t
  (print "Got here: db:get-tests-for-runs"))
(define (db:delete-test-records . args)
  #t
  (print "Got here: db:delete-test-records"))
(define (db:delete-old-deleted-test-records . args)
  #t
  (print "Got here: db:delete-old-deleted-test-records"))
(define (db:set-tests-state-status . args)
  #t
  (print "Got here: db:set-tests-state-status"))
(define (db:test-set-state-status . args)
  #t
  (print "Got here: db:test-set-state-status"))
(define (db:get-count-tests-running . args)
  #t
  (print "Got here: db:get-count-tests-running"))
(define (db:get-count-tests-actually-running . args)
  #t
  (print "Got here: db:get-count-tests-actually-running"))
(define (db:get-count-tests-running-for-run-id . args)
  #t
  (print "Got here: db:get-count-tests-running-for-run-id"))
(define (db:get-count-tests-running-for-testname . args)
  #t
  (print "Got here: db:get-count-tests-running-for-testname"))
(define (db:get-count-tests-running-in-jobgroup . args)
  #t
  (print "Got here: db:get-count-tests-running-in-jobgroup"))
(define (db:estimated-tests-remaining . args)
  #t
  (print "Got here: db:estimated-tests-remaining"))
(define (db:get-test-id . args)
  #t
  (print "Got here: db:get-test-id"))
(define (db:test-set-top-process-pid . args)
  #t
  (print "Got here: db:test-set-top-process-pid"))
(define (db:test-get-top-process-pid . args)
  #t
  (print "Got here: db:test-get-top-process-pid"))
(define (db:field->number . args)
  #t
  (print "Got here: db:field->number"))
(define (db:get-all-tests-info-by-run-id . args)
  #t
  (print "Got here: db:get-all-tests-info-by-run-id"))
(define (db:replace-test-records . args)
  #t
  (print "Got here: db:replace-test-records"))
(define (db:adj-test-id . args)
  #t
  (print "Got here: db:adj-test-id"))
(define (db:prep-megatest.db-adj-test-ids . args)
  #t
  (print "Got here: db:prep-megatest.db-adj-test-ids"))
(define (db:prep-megatest.db-for-migration . args)
  #t
  (print "Got here: db:prep-megatest.db-for-migration"))
(define (db:get-test-info-by-id . args)
  #t
  (print "Got here: db:get-test-info-by-id"))
(define (db:get-test-info-by-ids . args)
  #t
  (print "Got here: db:get-test-info-by-ids"))
(define (db:get-test-info . args)
  #t
  (print "Got here: db:get-test-info"))
(define (db:test-get-rundir-from-test-id . args)
  #t
  (print "Got here: db:test-get-rundir-from-test-id"))
(define (db:get-test-times . args)
  #t
  (print "Got here: db:get-test-times"))
(define (db:get-test-times . args)
  #t
  (print "Got here: db:get-test-times"))
(define (db:teststep-set-status! . args)
  #t
  (print "Got here: db:teststep-set-status!"))
(define (db:get-steps-for-test . args)
  #t
  (print "Got here: db:get-steps-for-test"))
(define (db:get-steps-info-by-id . args)
  #t
  (print "Got here: db:get-steps-info-by-id"))
(define (db:get-steps-data . args)
  #t
  (print "Got here: db:get-steps-data"))
(define (db:get-data-info-by-id . args)
  #t
  (print "Got here: db:get-data-info-by-id"))
(define (db:test-data-rollup . args)
  #t
  (print "Got here: db:test-data-rollup"))
(define (db:logpro-dat->csv . args)
  #t
  (print "Got here: db:logpro-dat->csv"))
(define (db:csv->test-data . args)
  #t
  (print "Got here: db:csv->test-data"))
(define (db:read-test-data . args)
  #t
  (print "Got here: db:read-test-data"))
(define (db:read-test-data* . args)
  #t
  (print "Got here: db:read-test-data*"))
(define (db:get-run-ids-matching-target . args)
  #t
  (print "Got here: db:get-run-ids-matching-target"))
(define (db:test-get-paths-matching-keynames-target-new . args)
  #t
  (print "Got here: db:test-get-paths-matching-keynames-target-new"))
(define (db:test-toplevel-num-items . args)
  #t
  (print "Got here: db:test-toplevel-num-items"))
(define (db:obj->string . args)
  #t
  (print "Got here: db:obj->string"))
(define (db:string->obj . args)
  #t
  (print "Got here: db:string->obj"))
(define (db:set-state-status-and-roll-up-items . args)
  #t
  (print "Got here: db:set-state-status-and-roll-up-items"))
(define (db:get-all-state-status-counts-for-test . args)
  #t
  (print "Got here: db:get-all-state-status-counts-for-test"))
(define (db:test-get-logfile-info . args)
  #t
  (print "Got here: db:test-get-logfile-info"))
(define (db:lookup-query . args)
  #t
  (print "Got here: db:lookup-query"))
(define (db:login . args)
  #t
  (print "Got here: db:login"))
(define (db:general-call . args)
  #t
  (print "Got here: db:general-call"))
(define (db:get-state-status-summary . args)
  #t
  (print "Got here: db:get-state-status-summary"))
(define (db:get-latest-host-load . args)
  #t
  (print "Got here: db:get-latest-host-load"))
(define (db:set-top-level-from-items . args)
  #t
  (print "Got here: db:set-top-level-from-items"))
(define (db:get-matching-previous-test-run-records . args)
  #t
  (print "Got here: db:get-matching-previous-test-run-records"))
(define (db:delay-if-busy . args)
  #t
  (print "Got here: db:delay-if-busy"))
(define (db:test-get-records-for-index-file . args)
  #t
  (print "Got here: db:test-get-records-for-index-file"))
(define (db:get-tests-tags . args)
  #t
  (print "Got here: db:get-tests-tags"))
(define (db:testmeta-get-record . args)
  #t
  (print "Got here: db:testmeta-get-record"))
(define (db:testmeta-add-record . args)
  #t
  (print "Got here: db:testmeta-add-record"))
(define (db:testmeta-update-field . args)
  #t
  (print "Got here: db:testmeta-update-field"))
(define (db:testmeta-get-all . args)
  #t
  (print "Got here: db:testmeta-get-all"))
(define (db:compare-itempaths . args)
  #t
  (print "Got here: db:compare-itempaths"))
(define (db:convert-test-itempath . args)
  #t
  (print "Got here: db:convert-test-itempath"))
(define (db:multi-pattern-apply . args)
  #t
  (print "Got here: db:multi-pattern-apply"))
(define (db:get-prereqs-not-met . args)
  #t
  (print "Got here: db:get-prereqs-not-met"))
(define (db:get-run-record-ids . args)
  #t
  (print "Got here: db:get-run-record-ids"))
(define (db:get-changed-record-ids . args)
  #t
  (print "Got here: db:get-changed-record-ids"))
(define (db:extract-ods-file . args)
  #t
  (print "Got here: db:extract-ods-file"))

;;======================================================================
;; Strings table (kept in the <runid>.db)
;;======================================================================

;; Move this into the runid db init
;;

Modified mtserve.scm from [0b98a50db4] to [cd66a1f6ba].

26
27
28
29
30
31
32


33
34
35
36
37
38
39
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







+
+







     readline apropos json directory-utils typed-records
     srfi-18 extras format (prefix pkts pkts:))

(declare (uses common))
(declare (uses megatest-version))
(declare (uses margs))
(declare (uses server))
(declare (uses rmt))

;; (declare (uses daemon))

(declare (uses db))
(import db)

(declare (uses portlogger))
(import portlogger)
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
90
91
92
93
94
95
96

97

98
99
100
101
102
103
104







-
+
-







Usage: mtserver [options]
  -h                      : this help
  -manual                 : show the Megatest user manual
  -version                : print megatest version (currently " megatest-version ")

Launching and managing runs
  -run                    : run all tests or as specified by -testpatt
  -server -|hostname      : start the server (reduces contention on megatest.db), use
  -server main|passive    : start the server in \"main\" mode or \"passive\" mode
                            - to automatically figure out hostname
  -log logfile            : send stdout and stderr to logfile
  -list-servers           : list the servers 
  -kill-servers           : kill all servers
  -repl                   : start a repl (useful for extending megatest)
  -ping run-id|host:port  : ping server, exit with 0 if found
  -debug N|N,M,O...       : enable debug 0-N or N and M and O ...

121
122
123
124
125
126
127

128
129
130
131
132
133
134
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136







+







			"-log"
			)
 		 (list  "-h" "-help" "--help"
			"-manual"
			"-version"
		        "-list-servers"
			"-kill-servers"
			"-repl"
                        "-v" ;; verbose 2, more than normal (normal is 1)
			"-q" ;; quiet 0, errors/warnings only

                        "-diff-rep"
                        )
		 args:arg-hash
		 0))
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
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
153
154
155
156
157
158
159





160
161


162
163
164
165
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







-
-
-
-
-


-
-









+







+
+


















-
+







        (let ((fullpath (common:real-path (args:get-arg "-start-dir"))))
          (setenv "PWD" fullpath)
          (change-directory fullpath))
	(begin
	  (debug:print-error 0 *default-log-port* "non-existant start dir " (args:get-arg "-start-dir") " specified, exiting.")
	  (exit 1))))

;; immediately set MT_TARGET if -reqtarg or -target are available
;;
(let ((targ (or (args:get-arg "-reqtarg")(args:get-arg "-target"))))
  (if targ (setenv "MT_TARGET" targ)))

;; The watchdog is to keep an eye on things like db sync etc.
;;

;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(define *watchdog* (make-thread
		    (lambda ()
		      (handle-exceptions
			  exn
			  (begin
			    (print-call-chain)
			    (print " message: " ((condition-property-accessor 'exn 'message) exn)))
			(common:watchdog)))
		    "Watchdog thread"))

;;======================================================================
;; Strive for clean exit handling
;;======================================================================

(define (server-exit-procedure)
  (on-exit (lambda ()
	     ;; close the databases, ensure the pkt is removed!
	     
	     (server:shutdown)
	     0)))

;; Copied from the SDL2 examples.
;;
;; Schedule quit! to be automatically called when your program exits normally.
(on-exit server-exit-procedure)

;; Install a custom exception handler that will call quit! and then
;; call the original exception handler. This ensures that quit! will
;; be called even if an unhandled exception reaches the top level.
(current-exception-handler
 (let ((original-handler (current-exception-handler)))
   (lambda (exception)
     (server-exit-procedure)
     (original-handler exception))))

;;(if (not (args:get-arg "-server"))
;;    (thread-start! *watchdog*)) ;; if starting a server; wait till we get to running state before kicking off watchdog
(let* ((no-watchdog-args
#;(let* ((no-watchdog-args
       '("-list-runs"
         "-testdata-csv"
         "-list-servers"
         "-server"
         "-list-disks"
         "-list-targets"
         "-show-runconfig"
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243







-
+







        (define *didsomething* #t)  
        (exit 1))))

;; this segment will run launch:setup only if -log is not set. This is fairly safe as servers are not
;; manually started and thus should never be started in a non-megatest area. Thus no need to handle situation
;; where (launch:setup) returns #f?
;;
(if (or (args:get-arg "-log")(args:get-arg "-server")) ;; redirect the log always when a server
#;(if (or (args:get-arg "-log")(args:get-arg "-server")) ;; redirect the log always when a server
    (handle-exceptions
	exn
	(begin
	  (print "ERROR: Failed to switch to log output. " ((condition-property-accessor 'exn 'message) exn))
	  )
      (let* ((tl   (or (args:get-arg "-log")(launch:setup)))   ;; run launch:setup if -server, ensure we do NOT run launch:setup if -log specified
	     (logf (or (args:get-arg "-log") ;; use -log unless we are a server, then craft a logfile name
259
260
261
262
263
264
265
266
























257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

(if (args:get-arg "-version")
    (begin
      (print (common:version-signature)) ;; (print megatest-version)
      (exit)))

(define *didsomething* #f)

;; ready? start the server
;;
(if (args:get-arg "-server")
    (let ((mode (string->symbol (args:get-arg "-server"))))
      (if (not (server:launch mode)) ;; opens the port, drops the pkt, contacts other servers and then waits for messages
	  (exit 1))))

(if (args:get-arg "-repl")
    (begin
      ;; user will have to start the server manually
      (print "Run: (server:start-nmsg 'main) to start the server")
      (import extras) ;; might not be needed
      ;; (import csi)
      (import readline)
      (import apropos)
      (import portlogger)
      ;; (import (prefix sqlite3 sqlite3:)) ;; doesn't work ...
      
      (install-history-file (get-environment-variable "HOME") ".megatest_history") ;;  [homedir] [filename] [nlines])
      (current-input-port (make-readline-port "megatest> "))
      (repl)
      (set! *didsomething* #t)))


Modified mtut.scm from [da1a65f5ac] to [b8b7168231].

27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41







-
+







     (prefix dbi dbi:)
     nanomsg)

(declare (uses common))
(declare (uses megatest-version))
(declare (uses margs))
(declare (uses configf))
;; (declare (uses rmt))
(declare (uses rmt))

(use ducttape-lib)

(include "megatest-fossil-hash.scm")

(require-library stml)

Modified nmsg-transport.scm from [69e3d806c5] to [a6db5a6966].

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
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







+




-


















+
+





-














-
+
-
-








(module
    nmsg-transport
    (
     nmsg:start-server
     nmsg:open-send-close
     nmsg:open-send-receive
     nmsg:close
     )

(import scheme posix chicken data-structures ports)

(use pkts)
(use nanomsg srfi-18)

;;start a server, returns the connection
;;
(define (nmsg:start-server portnum )
  (let ((rep (nn-socket 'rep)))
    (handle-exceptions
     exn
     (let ((emsg ((condition-property-accessor 'exn 'message) exn)))
       (print "ERROR: Failed to start server \"" emsg "\"")
       #f)
     (nn-bind rep (conc "tcp://*:" portnum)))
    rep))

;; open connection to server, send message, close connection
;;
;;  to take an action on failure use proc which is called with the error info
;;    (proc exn errormsg)
;;
;;  returns the response or #f if no response within timeout
;;
(define (nmsg:open-send-close host-port msg attrib #!key (timeout 3)(proc #f)) ;; default timeout is 3 seconds
  (let ((req  (nn-socket 'req))
        (uri  (conc "tcp://" host-port))
        (res  #f)
        ;; (contacts (alist-ref 'contact attrib))
        (mode (alist-ref 'mode attrib))) 
    (handle-exceptions
     exn
     (let ((emsg ((condition-property-accessor 'exn 'message) exn)))
       ;; Send notification
       (if proc (proc exn emsg))
       #f)
     (nn-connect req uri)
     (print "Connected to the server " )
     (nn-send req msg)
     (print "Request Sent")  
     (let* ((th1  (make-thread (lambda ()
                                 (let ((resp (nn-recv req)))
                                   (nn-close req)
                                   (set! res (if (equal? resp "ok")
                                   (set! res resp)))
                                                 #t
                                                 #f))))
                               "recv thread"))
            (th2 (make-thread (lambda ()
                                (thread-sleep! timeout)
                                (thread-terminate! th1))
                             "timer thread")))
       (thread-start! th1)
       (thread-start! th2)
117
118
119
120
121
122
123
124
125

126

127
128
116
117
118
119
120
121
122


123

124
125
126







-
-
+
-
+


                                (thread-terminate! th1))
                             "timer thread")))
       (thread-start! th1)
       (thread-start! th2)
       (thread-join! th1)
       res))))

;; get a signature for identifing this process
(define (nmsg:get-process-signature)
(define (nmsg:close conn)
  (conc (get-host-name) " " (current-process-id)))
  (nn-close conn))

)

Modified rmt.scm from [75cad94866] to [3585e1244b].

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

































































































































































































































































































































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
159
160
161
162
163
164
165
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
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







+
+


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
;;
;;======================================================================

(use format typed-records) ;; RADT => purpose of json format??

(declare (unit rmt))
(declare (uses api))
(import api)

(include "common_records.scm")

(use (prefix pkts pkts:) srfi-18)

(defstruct cmdrec
  cmd
  (host    #f)
  (run-ids #f)
  params)

;; call cmd on remote host (#f for any host)
;;
;; example: (rmt:run 'get-runs target run-name test-patt state status)
;;
(define (rmt:run cmd . params)
  (let ((server (rmt:get-server cmdrec))) ;; look up server 
    #f))
  
(define (rmt:get-connection-info . args) #t)
(define (rmt:send-receive . args) #t)
(define (rmt:print-db-stats . args) #t)
(define (rmt:get-max-query-average . args) #t)
(define (rmt:open-qry-close-locally . args) #t)
(define (rmt:send-receive-no-auto-client-setup . args) #t)
(define (rmt:kill-server . args) #t)
(define (rmt:start-server . args) #t)
(define (rmt:login . args) #t)
(define (rmt:login-no-auto-client-setup . args) #t)
(define (rmt:general-call . args) #t)
(define (rmt:get-latest-host-load . args) #t)
(define (rmt:sdb-qry . args) #t)
(define (rmt:runtests . args) #t)
(define (rmt:get-run-record-ids . args) #t)
(define (rmt:get-changed-record-ids . args) #t)
(define (rmt:get-tests-tags . args) #t)
(define (rmt:get-key-val-pairs . args) #t)
(define (rmt:get-keys . args) #t)
(define (rmt:get-keys-write . args) #t)
(define (rmt:get-key-vals . args) #t)
(define (rmt:get-targets . args) #t)
(define (rmt:get-target . args) #t)
(define (rmt:get-run-times . args) #t)
(define (rmt:register-test . args) #t)
(define (rmt:get-test-id . args) #t)
(define (rmt:get-test-info-by-id . args) #t)
(define (rmt:test-get-rundir-from-test-id . args) #t)
(define (rmt:open-test-db-by-test-id . args) #t)
(define (rmt:test-set-state-status-by-id . args) #t)
(define (rmt:set-tests-state-status . args) #t)
(define (rmt:get-tests-for-run . args) #t)
(define (rmt:synchash-get . args) #t)
(define (rmt:get-tests-for-run-mindata . args) #t)
(define (rmt:get-tests-for-runs-mindata . args) #t)
(define (rmt:delete-test-records . args) #t)
(define (rmt:test-set-state-status . args) #t)
(define (rmt:test-toplevel-num-items . args) #t)
(define (rmt:get-matching-previous-test-run-records . args) #t)
(define (rmt:test-get-logfile-info . args) #t)
(define (rmt:test-get-records-for-index-file . args) #t)
(define (rmt:get-testinfo-state-status . args) #t)
(define (rmt:test-set-log! . args) #t)
(define (rmt:test-set-top-process-pid . args) #t)
(define (rmt:test-get-top-process-pid . args) #t)
(define (rmt:get-run-ids-matching-target . args) #t)
(define (rmt:test-get-paths-matching-keynames-target-new . args) #t)
(define (rmt:get-prereqs-not-met . args) #t)
(define (rmt:get-count-tests-running-for-run-id . args) #t)
(define (rmt:get-count-tests-running . args) #t)
(define (rmt:get-count-tests-running-for-testname . args) #t)
(define (rmt:get-count-tests-running-in-jobgroup . args) #t)
(define (rmt:set-state-status-and-roll-up-items . args) #t)
(define (rmt:update-pass-fail-counts . args) #t)
(define (rmt:top-test-set-per-pf-counts . args) #t)
(define (rmt:get-raw-run-stats . args) #t)
(define (rmt:get-test-times . args) #t)
(define (rmt:get-run-info . args) #t)
(define (rmt:get-num-runs . args) #t)
(define (rmt:get-runs-cnt-by-patt . args) #t)
(define (rmt:register-run . args) #t)
(define (rmt:get-run-name-from-id . args) #t)
(define (rmt:delete-run . args) #t)
(define (rmt:update-run-stats . args) #t)
(define (rmt:delete-old-deleted-test-records . args) #t)
(define (rmt:get-runs . args) #t)
(define (rmt:simple-get-runs . args) #t)
(define (rmt:get-all-run-ids . args) #t)
(define (rmt:get-prev-run-ids . args) #t)
(define (rmt:lock/unlock-run . args) #t)
(define (rmt:get-run-status . args) #t)
(define (rmt:set-run-status . args) #t)
(define (rmt:update-run-event_time . args) #t)
(define (rmt:get-runs-by-patt . args) #t)
(define (rmt:find-and-mark-incomplete . args) #t)
(define (rmt:get-main-run-stats . args) #t)
(define (rmt:get-var . args) #t)
(define (rmt:del-var . args) #t)
(define (rmt:set-var . args) #t)
(define (rmt:find-and-mark-incomplete-all-runs . args) #t)
(define (rmt:get-previous-test-run-record . args) #t)
(define (rmt:get-run-stats . args) #t)
(define (rmt:teststep-set-status! . args) #t)
(define (rmt:get-steps-for-test . args) #t)
(define (rmt:get-steps-info-by-id . args) #t)
(define (rmt:read-test-data . args) #t)
(define (rmt:read-test-data* . args) #t)
(define (rmt:get-data-info-by-id . args) #t)
(define (rmt:testmeta-add-record . args) #t)
(define (rmt:testmeta-get-record . args) #t)
(define (rmt:testmeta-update-field . args) #t)
(define (rmt:test-data-rollup . args) #t)
(define (rmt:csv->test-data . args) #t)
(define (rmt:tasks-find-task-queue-records . args) #t)
(define (rmt:tasks-add . args) #t)
(define (rmt:tasks-set-state-given-param-key . args) #t)
(define (rmt:tasks-get-last . args) #t)
(define (rmt:no-sync-set . args) #t)
(define (rmt:no-sync-get/default . args) #t)
(define (rmt:no-sync-del! . args) #t)
(define (rmt:no-sync-get-lock . args) #t)
(define (rmt:archive-get-allocations . args) #t)
(define (rmt:archive-register-block-name . args) #t)
(define (rmt:archive-allocate-testsuite/area-to-block . args) #t)
(define (rmt:archive-register-disk . args) #t)
(define (rmt:test-set-archive-block-id . args) #t)
(define (rmt:test-get-archive-block-info . args) #t)
(define (rmt:get-connection-info . args)
  #t
  (print "Got here: rmt:get-connection-info"))
(define (rmt:send-receive . args)
  #t
  (print "Got here: rmt:send-receive"))
(define (rmt:print-db-stats . args)
  #t
  (print "Got here: rmt:print-db-stats"))
(define (rmt:get-max-query-average . args)
  #t
  (print "Got here: rmt:get-max-query-average"))
(define (rmt:open-qry-close-locally . args)
  #t
  (print "Got here: rmt:open-qry-close-locally"))
(define (rmt:send-receive-no-auto-client-setup . args)
  #t
  (print "Got here: rmt:send-receive-no-auto-client-setup"))
(define (rmt:kill-server . args)
  #t
  (print "Got here: rmt:kill-server"))
(define (rmt:start-server . args)
  #t
  (print "Got here: rmt:start-server"))
(define (rmt:login . args)
  #t
  (print "Got here: rmt:login"))
(define (rmt:login-no-auto-client-setup . args)
  #t
  (print "Got here: rmt:login-no-auto-client-setup"))
(define (rmt:general-call . args)
  #t
  (print "Got here: rmt:general-call"))
(define (rmt:get-latest-host-load . args)
  #t
  (print "Got here: rmt:get-latest-host-load"))
(define (rmt:sdb-qry . args)
  #t
  (print "Got here: rmt:sdb-qry"))
(define (rmt:runtests . args)
  #t
  (print "Got here: rmt:runtests"))
(define (rmt:get-run-record-ids . args)
  #t
  (print "Got here: rmt:get-run-record-ids"))
(define (rmt:get-changed-record-ids . args)
  #t
  (print "Got here: rmt:get-changed-record-ids"))
(define (rmt:get-tests-tags . args)
  #t
  (print "Got here: rmt:get-tests-tags"))
(define (rmt:get-key-val-pairs . args)
  #t
  (print "Got here: rmt:get-key-val-pairs"))
(define (rmt:get-keys . args)
  #t
  (print "Got here: rmt:get-keys"))
(define (rmt:get-keys-write . args)
  #t
  (print "Got here: rmt:get-keys-write"))
(define (rmt:get-key-vals . args)
  #t
  (print "Got here: rmt:get-key-vals"))
(define (rmt:get-targets . args)
  #t
  (print "Got here: rmt:get-targets"))
(define (rmt:get-target . args)
  #t
  (print "Got here: rmt:get-target"))
(define (rmt:get-run-times . args)
  #t
  (print "Got here: rmt:get-run-times"))
(define (rmt:register-test . args)
  #t
  (print "Got here: rmt:register-test"))
(define (rmt:get-test-id . args)
  #t
  (print "Got here: rmt:get-test-id"))
(define (rmt:get-test-info-by-id . args)
  #t
  (print "Got here: rmt:get-test-info-by-id"))
(define (rmt:test-get-rundir-from-test-id . args)
  #t
  (print "Got here: rmt:test-get-rundir-from-test-id"))
(define (rmt:open-test-db-by-test-id . args)
  #t
  (print "Got here: rmt:open-test-db-by-test-id"))
(define (rmt:test-set-state-status-by-id . args)
  #t
  (print "Got here: rmt:test-set-state-status-by-id"))
(define (rmt:set-tests-state-status . args)
  #t
  (print "Got here: rmt:set-tests-state-status"))
(define (rmt:get-tests-for-run . args)
  #t
  (print "Got here: rmt:get-tests-for-run"))
(define (rmt:synchash-get . args)
  #t
  (print "Got here: rmt:synchash-get"))
(define (rmt:get-tests-for-run-mindata . args)
  #t
  (print "Got here: rmt:get-tests-for-run-mindata"))
(define (rmt:get-tests-for-runs-mindata . args)
  #t
  (print "Got here: rmt:get-tests-for-runs-mindata"))
(define (rmt:delete-test-records . args)
  #t
  (print "Got here: rmt:delete-test-records"))
(define (rmt:test-set-state-status . args)
  #t
  (print "Got here: rmt:test-set-state-status"))
(define (rmt:test-toplevel-num-items . args)
  #t
  (print "Got here: rmt:test-toplevel-num-items"))
(define (rmt:get-matching-previous-test-run-records . args)
  #t
  (print "Got here: rmt:get-matching-previous-test-run-records"))
(define (rmt:test-get-logfile-info . args)
  #t
  (print "Got here: rmt:test-get-logfile-info"))
(define (rmt:test-get-records-for-index-file . args)
  #t
  (print "Got here: rmt:test-get-records-for-index-file"))
(define (rmt:get-testinfo-state-status . args)
  #t
  (print "Got here: rmt:get-testinfo-state-status"))
(define (rmt:test-set-log! . args)
  #t
  (print "Got here: rmt:test-set-log!"))
(define (rmt:test-set-top-process-pid . args)
  #t
  (print "Got here: rmt:test-set-top-process-pid"))
(define (rmt:test-get-top-process-pid . args)
  #t
  (print "Got here: rmt:test-get-top-process-pid"))
(define (rmt:get-run-ids-matching-target . args)
  #t
  (print "Got here: rmt:get-run-ids-matching-target"))
(define (rmt:test-get-paths-matching-keynames-target-new . args)
  #t
  (print "Got here: rmt:test-get-paths-matching-keynames-target-new"))
(define (rmt:get-prereqs-not-met . args)
  #t
  (print "Got here: rmt:get-prereqs-not-met"))
(define (rmt:get-count-tests-running-for-run-id . args)
  #t
  (print "Got here: rmt:get-count-tests-running-for-run-id"))
(define (rmt:get-count-tests-running . args)
  #t
  (print "Got here: rmt:get-count-tests-running"))
(define (rmt:get-count-tests-running-for-testname . args)
  #t
  (print "Got here: rmt:get-count-tests-running-for-testname"))
(define (rmt:get-count-tests-running-in-jobgroup . args)
  #t
  (print "Got here: rmt:get-count-tests-running-in-jobgroup"))
(define (rmt:set-state-status-and-roll-up-items . args)
  #t
  (print "Got here: rmt:set-state-status-and-roll-up-items"))
(define (rmt:update-pass-fail-counts . args)
  #t
  (print "Got here: rmt:update-pass-fail-counts"))
(define (rmt:top-test-set-per-pf-counts . args)
  #t
  (print "Got here: rmt:top-test-set-per-pf-counts"))
(define (rmt:get-raw-run-stats . args)
  #t
  (print "Got here: rmt:get-raw-run-stats"))
(define (rmt:get-test-times . args)
  #t
  (print "Got here: rmt:get-test-times"))
(define (rmt:get-run-info . args)
  #t
  (print "Got here: rmt:get-run-info"))
(define (rmt:get-num-runs . args)
  #t
  (print "Got here: rmt:get-num-runs"))
(define (rmt:get-runs-cnt-by-patt . args)
  #t
  (print "Got here: rmt:get-runs-cnt-by-patt"))
(define (rmt:register-run . args)
  #t
  (print "Got here: rmt:register-run"))
(define (rmt:get-run-name-from-id . args)
  #t
  (print "Got here: rmt:get-run-name-from-id"))
(define (rmt:delete-run . args)
  #t
  (print "Got here: rmt:delete-run"))
(define (rmt:update-run-stats . args)
  #t
  (print "Got here: rmt:update-run-stats"))
(define (rmt:delete-old-deleted-test-records . args)
  #t
  (print "Got here: rmt:delete-old-deleted-test-records"))
(define (rmt:get-runs . args)
  #t
  (print "Got here: rmt:get-runs"))
(define (rmt:simple-get-runs . args)
  #t
  (print "Got here: rmt:simple-get-runs"))
(define (rmt:get-all-run-ids . args)
  #t
  (print "Got here: rmt:get-all-run-ids"))
(define (rmt:get-prev-run-ids . args)
  #t
  (print "Got here: rmt:get-prev-run-ids"))
(define (rmt:lock/unlock-run . args)
  #t
  (print "Got here: rmt:lock/unlock-run"))
(define (rmt:get-run-status . args)
  #t
  (print "Got here: rmt:get-run-status"))
(define (rmt:set-run-status . args)
  #t
  (print "Got here: rmt:set-run-status"))
(define (rmt:update-run-event_time . args)
  #t
  (print "Got here: rmt:update-run-event_time"))
(define (rmt:get-runs-by-patt . args)
  #t
  (print "Got here: rmt:get-runs-by-patt"))
(define (rmt:find-and-mark-incomplete . args)
  #t
  (print "Got here: rmt:find-and-mark-incomplete"))
(define (rmt:get-main-run-stats . args)
  #t
  (print "Got here: rmt:get-main-run-stats"))
(define (rmt:get-var . args)
  #t
  (print "Got here: rmt:get-var"))
(define (rmt:del-var . args)
  #t
  (print "Got here: rmt:del-var"))
(define (rmt:set-var . args)
  #t
  (print "Got here: rmt:set-var"))
(define (rmt:find-and-mark-incomplete-all-runs . args)
  #t
  (print "Got here: rmt:find-and-mark-incomplete-all-runs"))
(define (rmt:get-previous-test-run-record . args)
  #t
  (print "Got here: rmt:get-previous-test-run-record"))
(define (rmt:get-run-stats . args)
  #t
  (print "Got here: rmt:get-run-stats"))
(define (rmt:teststep-set-status! . args)
  #t
  (print "Got here: rmt:teststep-set-status!"))
(define (rmt:get-steps-for-test . args)
  #t
  (print "Got here: rmt:get-steps-for-test"))
(define (rmt:get-steps-info-by-id . args)
  #t
  (print "Got here: rmt:get-steps-info-by-id"))
(define (rmt:read-test-data . args)
  #t
  (print "Got here: rmt:read-test-data"))
(define (rmt:read-test-data* . args)
  #t
  (print "Got here: rmt:read-test-data*"))
(define (rmt:get-data-info-by-id . args)
  #t
  (print "Got here: rmt:get-data-info-by-id"))
(define (rmt:testmeta-add-record . args)
  #t
  (print "Got here: rmt:testmeta-add-record"))
(define (rmt:testmeta-get-record . args)
  #t
  (print "Got here: rmt:testmeta-get-record"))
(define (rmt:testmeta-update-field . args)
  #t
  (print "Got here: rmt:testmeta-update-field"))
(define (rmt:test-data-rollup . args)
  #t
  (print "Got here: rmt:test-data-rollup"))
(define (rmt:csv->test-data . args)
  #t
  (print "Got here: rmt:csv->test-data"))
(define (rmt:tasks-find-task-queue-records . args)
  #t
  (print "Got here: rmt:tasks-find-task-queue-records"))
(define (rmt:tasks-add . args)
  #t
  (print "Got here: rmt:tasks-add"))
(define (rmt:tasks-set-state-given-param-key . args)
  #t
  (print "Got here: rmt:tasks-set-state-given-param-key"))
(define (rmt:tasks-get-last . args)
  #t
  (print "Got here: rmt:tasks-get-last"))
(define (rmt:no-sync-set . args)
  #t
  (print "Got here: rmt:no-sync-set"))
(define (rmt:no-sync-get/default . args)
  #t
  (print "Got here: rmt:no-sync-get/default"))
(define (rmt:no-sync-del! . args)
  #t
  (print "Got here: rmt:no-sync-del!"))
(define (rmt:no-sync-get-lock . args)
  #t
  (print "Got here: rmt:no-sync-get-lock"))
(define (rmt:archive-get-allocations . args)
  #t
  (print "Got here: rmt:archive-get-allocations"))
(define (rmt:archive-register-block-name . args)
  #t
  (print "Got here: rmt:archive-register-block-name"))
(define (rmt:archive-allocate-testsuite/area-to-block . args)
  #t
  (print "Got here: rmt:archive-allocate-testsuite/area-to-block"))
(define (rmt:archive-register-disk . args)
  #t
  (print "Got here: rmt:archive-register-disk"))
(define (rmt:test-set-archive-block-id . args)
  #t
  (print "Got here: rmt:test-set-archive-block-id"))
(define (rmt:test-get-archive-block-info . args)
  #t
  (print "Got here: rmt:test-get-archive-block-info"))

Modified server.scm from [c1e7b430f1] to [98632b547e].

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
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
159
160
161






162
163
164
165
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







-
+
+






+

+







+

















+
+



+



















-
+








-
+
+
+
+
+
+
+

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

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







;; nmsg-transport.scm file.
;;
;;======================================================================

(require-extension (srfi 18) extras tcp s11n)

(use srfi-1 posix regex regex-case srfi-69 hostinfo md5 message-digest
     directory-utils posix-extras matchable typed-records)
     directory-utils posix-extras matchable typed-records
     pkts)

(use spiffy uri-common intarweb http-client spiffy-request-vars)

(declare (unit server))

(declare (uses common))

(declare (uses db))
(import db)

;; Basic stuff for safely kicking off a server
(declare (uses portlogger))
(import portlogger)

(declare (uses nmsg-transport))
(import nmsg-transport)


;; Might want to bring the daemonizing back
;; (declare (uses daemon))

(include "common_records.scm")
(include "db_records.scm")

;;======================================================================
;; P K T S   S T U F F 
;;======================================================================

;;======================================================================
;;  N A N O M S G   B A S E D   S E R V E R
;;======================================================================

(defstruct nmsg
  (conn  #f)
  (port  #f)
  (myaddr #f)
  (hosts (make-hash-table))
  pkt
  pktspec
  pktfile
  (mutex    (make-mutex))
  )

;; make it a global? Well, it is local to nmsg module

(define *nmsg-conndat* (make-nmsg))
(nmsg-pktspec-set! *nmsg-conndat*
		   `((server (hostname . h)
			     (port     . p)
			     (pid      . i)
			     )))
;; get a port
;; start the nmsg server
;; look for other servers
;; contact other servers and compile list of servers
;; there are two types of server
;;     main servers - dashboards, runners and dedicated servers - need pkt
;;     passive servers - test executers, step calls, list-runs - no pkt
;;
(define (server:start-nmsg #!key (force-server-type #f))
(define (server:start-nmsg #!optional (force-server-type #f))
  (mutex-lock! (nmsg-mutex *nmsg-conndat*))
  (let* ((server-type  (or force-server-type
			   (if (args:any? "-run" "-server")
			       'main
			       'passive)))
	 (port-num     (portlogger:open-run-close portlogger:find-port))
	 (nmsg-conn    (nmsg:start-server port-num))
	 (pktspec      (nmsg-pktspec *nmsg-conndat*))
	 (pktdir       (conc (get-environment-variable "MT_RUN_AREA_HOME")
	 (mtdir        (or (get-environment-variable "MT_RUN_AREA_HOME")
				 (if (file-exists? "megatest.config")
				     (current-directory)
				     (begin
				       (print "ERROR: We don't appear to be in a megatest area and MT_RUN_AREA_HOME is not set.")
				       #f))))
	 (pktdir       (conc mtdir
			     "/.server-pkts")))
    (if (not mtdir)
	#f
	(begin
    (if (not (directory? pktdir))(create-directory pktdir))
    ;; server is started, now create pkt if needed
    (if (eq? server-type 'main)
	(nmsg-pkt-set! *nmsg-conndat* 
		       (pkts:write-alist->pkt
			pktdir 
			`((hostname . ,(get-host-name))
			  (port     . ,port-num)
			  (pid      . ,(current-process-id)))
			pktspec: pktspec
			ptype:   'server)))
    (nmsg-conn-set! *nmsg-conndat* nmsg-conn)
    (mutex-unlock! (nmsg-mutex *nmsg-conndat*))
    ))
	  (if  (not (directory? pktdir))(create-directory pktdir))
	  ;; server is started, now create pkt if needed
	  (if (eq? server-type 'main)
	      (begin
		(nmsg-pkt-set! *nmsg-conndat* 
			       (write-alist->pkt
				pktdir 
				`((hostname . ,(get-host-name))
				  (port     . ,port-num)
				  (pid      . ,(current-process-id)))
				pktspec: pktspec
				ptype:   'server))
		(nmsg-pktfile-set! *nmsg-conndat* (conc pktdir "/" (nmsg-pkt *nmsg-conndat*) ".pkt"))))
	  (nmsg-conn-set! *nmsg-conndat* nmsg-conn)
	  (nmsg-port-set! *nmsg-conndat* port-num)
	  (mutex-unlock! (nmsg-mutex *nmsg-conndat*))
	  #t))))

;; Call this to start the actual server
;;
;; start_server
;;
;;   mode: '
;;
(define (server:launch mode)
  (let ((start-time (current-seconds)))
    (server:start-nmsg mode)
    (let loop ((dead-time (- (current-seconds) start-time)))
      (thread-sleep! 1)
      (if (< dead-time 10)
	  (loop (- (current-seconds) start-time))
	  (print "Timed out. Exiting")))))

(define (server:shutdown)
  (let ((conn (nmsg-conn    *nmsg-conndat*))
	(pktf (nmsg-pktfile *nmsg-conndat*))
	(port (nmsg-port    *nmsg-conndat*)))
    (if conn
	(begin
	  (if pktf (delete-file* pktf))
	  (server:send-all "imshuttingdown")
	  (nmsg:close conn)
	  (portlogger:open-run-close portlogger:release-port port)))))

;; 
;; 
;; ;; Call this to start the actual server
;; ;;
;; 
(define (server:send-all msg)
  #f)

;; look up all pkts and get the server id (the hash), port, host/ip
;;
;; ;; all routes though here end in exit ...
;; ;;
;; ;; start_server
;; ;;
;; (define (server:launch run-id transport-type)
;;   (case transport-type
(define (server:get-all)
  '())

(define (server:get-my-best-address)
  (ip->string (car (filter (lambda (x)
;;     ((http)(http-transport:launch))
;;     ;;((nmsg)(nmsg-transport:launch run-id))
;;     ;;((rpc)  (rpc-transport:launch run-id))
;;     (else (debug:print-error 0 *default-log-port* "unknown server type " transport-type))))
;; 
;; ;;======================================================================
;; ;; S E R V E R   U T I L I T I E S 
;; ;;======================================================================
;; 
			     (not (eq? (u8vector-ref x 0) 127)))
			   (vector->list (hostinfo-addresses (hostname->hostinfo "zeus")))))))

;; whoami? I am my pkt
;;
(define (server:whoami?)
  (nmsg-pkt *nmsg-conndat*))

;;======================================================================
;; S E R V E R   U T I L I T I E S 
;;======================================================================

;; get a signature for identifing this process
(define (server:get-process-signature)
  (conc (get-host-name) " " (current-process-id)))


;; ;; Get the transport
;; (define (server:get-transport)
;;   (if *transport-type*
;;       *transport-type*
;;       (let ((ttype (string->symbol
;; 		    (or (args:get-arg "-transport")
;; 			(configf:lookup *configdat* "server" "transport")

Added utils/gen-list-of-functions.sh version [a5fa0df8c9].









1
2
3
4
5
6
7
8
+
+
+
+
+
+
+
+
#!/bin/bash

# extract a list of functions from a .scm file

INFILE=$1

grep -E '^\(define\s+\(' $INFILE|cut -f3 -d\(|tr ')' ' '|cut -f1 -d' '