Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -7,5 +7,7 @@ megatest dboard tests/fullrun/tmp/* tests/simpleruns tests/simplelinks +mkdeploy/runs +mkdeploy/links Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -14,12 +14,16 @@ OFILES = $(SRCFILES:%.scm=%.o) GOFILES = $(GUISRCF:%.scm=%.o) ADTLSCR=mt_laststep mt_runstep mt_ezstep HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR)) -DEPLOYHELPERS=$(addprefix $(DEPLOYTARG)/,$(ADTLSCR)) +DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR)) MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}') + +CSIPATH=$(shell which csi) +CKPATH=$(shell dirname $(shell dirname $(CSIPATH))) + all : mtest dboard newdashboard mtest: $(OFILES) megatest.o csc $(CSCOPTS) $(OFILES) megatest.o -o mtest @@ -27,15 +31,24 @@ csc $(OFILES) dashboard.scm $(GOFILES) -o dboard newdashboard : newdashboard.scm $(OFILES) csc $(OFILES) newdashboard.scm -o newdashboard -$(DEPLOYTARG)/megatest : $(OFILES) megatest.o - csc -deployed $(CSCOPTS) $(OFILES) megatest.o -o $(DEPLOYTARG)/megatest +deploytarg/libiupcd.so : $(CKPATH)/lib/libiupcd.so + for i in iup im cd av call sqlite; do \ + cp $(CKPATH)/lib/lib$$i* deploytarg/ ; \ + done + cp $(CKPATH)/include/*.h deploytarg + +# puts deployed megatest in directory "megatest" +deploytarg/megatest : $(OFILES) megatest.o + csc -deploy $(CSCOPTS) $(OFILES) megatest.scm + rsync -av megatest/ deploytarg/ -$(DEPLOYTARG)/dashboard : $(OFILES) $(GOFILES) - csc -deployed $(OFILES) $(GOFILES) -o $(DEPLOYTARG)/dashboard +deploytarg/dashboard : $(OFILES) $(GOFILES) + csc -deploy $(OFILES) $(GOFILES) dashboard.scm + rsync -av dashboard/ deploytarg/ # Special dependencies for the includes tests.o db.o launch.o runs.o dashboard-tests.o dashboard-guimonitor.o dashboard-main.o monitor.o dashboard.o megatest.o : db_records.scm tests.o runs.o dashboard.o dashboard-tests.o dashboard-main.o : run_records.scm @@ -57,10 +70,13 @@ @echo Installing to PREFIX=$(PREFIX) $(INSTALL) mtest $(PREFIX)/bin/mtest utils/mk_wrapper $(PREFIX) mtest > $(PREFIX)/bin/megatest chmod a+x $(PREFIX)/bin/megatest +$(PREFIX)/bin/newdashboard : newdashboard + $(INSTALL) newdashboard $(PREFIX)/bin/newdashboard + $(HELPERS) : utils/mt_* $(INSTALL) $< $@ chmod a+x $@ $(DEPLOYHELPERS) : utils/mt_* @@ -73,15 +89,15 @@ $(PREFIX)/bin/nbfind : utils/nbfind $(INSTALL) $< $@ chmod a+x $@ -$(DEPLOYTARG)/nbfake : utils/nbfake +deploytarg/nbfake : utils/nbfake $(INSTALL) $< $@ chmod a+x $@ -$(DEPLOYTARG)/nbfind : utils/nbfind +deploytarg/nbfind : utils/nbfind $(INSTALL) $< $@ chmod a+x $@ # install dashboard as dboard so wrapper script can be called dashboard @@ -88,13 +104,22 @@ $(PREFIX)/bin/dboard : dboard $(FILES) $(INSTALL) dboard $(PREFIX)/bin/dboard utils/mk_wrapper $(PREFIX) dboard > $(PREFIX)/bin/dashboard chmod a+x $(PREFIX)/bin/dashboard -install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake $(PREFIX)/bin/nbfind +install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdashboard + +deploytarg/apropos.so : Makefile + for i in apropos base64 canvas-draw csv-xml directory-utils dot-locking extras fmt format hostinfo http-client intarweb json md5 message-digest posix posix-extras readline regex regex-case s11n spiffy spiffy-request-vars sqlite3 srfi-1 srfi-18 srfi-69 tcp test uri-common zmq check-errors synch matchable sql-null tcp-server rpc blob-utils string-utils variable-item defstruct uri-generic sendfile opensll openssl lookup-table list-utils stack; do \ + chicken-install -prefix deploytarg -deploy $$i;done + +deploytarg/libsqlite3.so : + CSC_OPTIONS="-Ideploytarg -Ldeploytarg" $CHICKEN_INSTALL -prefix deploytarg -deploy sqlite3 + + -deploy : $(DEPLOYTARG)/megatest $(DEPLOYTARG)/dashboard $(DEPLOYHELPERS) $(DEPLOYTARG)/nbfake $(DEPLOYTARG)/nbfind +deploy : deploytarg/megatest deploytarg/dashboard $(DEPLOYHELPERS) deploytarg/nbfake deploytarg/nbfind deploytarg/libiupcd.so deploytarg/apropos.so bin : mkdir -p $(PREFIX)/bin Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -239,10 +239,12 @@ (if match ;; (and match (list? match)(> (length match) 1)) (cadr match) #f)) )) #f)) + +(define configf:lookup config-lookup) (define (configf:section-vars cfgdat section) (let ((sectdat (hash-table-ref/default cfgdat section '()))) (if (null? sectdat) '() Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -59,10 +59,11 @@ "-test" "-debug" "-host" ) (list "-h" + "-use-server" "-guimonitor" "-main" "-v" "-q" ) @@ -83,11 +84,13 @@ (if (args:get-arg "-host") (begin (set! *runremote* (string-split (args:get-arg "-host" ":"))) (client:launch)) - (client:launch)) + (if (not (args:get-arg "-use-server")) + (set! *transport-type* 'fs) ;; force fs access + (client:launch))) ;; HACK ALERT: this is a hack, please fix. (define *read-only* (not (file-read-access? (conc *toppath* "/megatest.db")))) ;; (client:setup *db*) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -260,10 +260,20 @@ (sqlite3:execute db "PRAGMA synchronous = FULL;") (debug:print-info 11 "Initialized test database " dbpath) (db:testdb-initialize db))) ;; (sqlite3:execute db "PRAGMA synchronous = 0;") (debug:print-info 11 "open-test-db END (sucessful)" testpath) + ;; now let's test that everything is correct + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: problem accessing test db " testpath ", you probably should clean and re-run this test" + ((condition-property-accessor 'exn 'message) exn)) + #f) + ;; Is there a cheaper single line operation that will check for existance of a table + ;; and raise an exception ? + (sqlite3:execute db "SELECT id FROM test_data LIMIT 1;")) db) (begin (debug:print-info 11 "open-test-db END (unsucessful)" testpath) #f))) ADDED docs/dashboard-and-other-windows.png Index: docs/dashboard-and-other-windows.png ================================================================== --- /dev/null +++ docs/dashboard-and-other-windows.png cannot compute difference between binary files ADDED docs/dashboard-small.png Index: docs/dashboard-small.png ================================================================== --- /dev/null +++ docs/dashboard-small.png cannot compute difference between binary files Index: docs/dashboard-test.png ================================================================== --- docs/dashboard-test.png +++ docs/dashboard-test.png cannot compute difference between binary files Index: docs/manual/megatest_manual.html ================================================================== --- docs/manual/megatest_manual.html +++ docs/manual/megatest_manual.html @@ -745,24 +745,20 @@

Dedication

-

Dedicated to my wife, Joanna, who has, for many years now, supported -all my wacky ideas and nutty projects with only the occasional grumble -and roll of the eyes.

+

Dedicated to my wife Joanna who has kindly supported my working on various projects over the years.

Thanks

-

To all the great people from the various places I’ve worked over the -years, thank you. I’ve benefitted from your patience and insight and I -hope that some of what I’ve learned from you has been incorporated -into Megatest.

-

Also, my thanks to all the wonderful open source creators. These -truly free projects, from Linux, xemacs, chicken scheme, and fossil to -asciidoc and bash are the philosophical and direct underpinnings of -the Megatest project.

+

Thank you the many people I’ve worked over the years who have +shared their knowledge and insights with me.

+

Thanks also to the creators of the various open source projects that +Megatest is built on. These include Linux, xemacs, chicken scheme, +fossil and asciidoc. Without these projects something like Megatest +would be difficult or impossible to do.

@@ -1004,10 +1000,10 @@

Index: docs/manual/megatest_manual.txt ================================================================== --- docs/manual/megatest_manual.txt +++ docs/manual/megatest_manual.txt @@ -7,26 +7,22 @@ [dedication] Dedication ========== -Dedicated to my wife, Joanna, who has, for many years now, supported -all my wacky ideas and nutty projects with only the occasional grumble -and roll of the eyes. +Dedicated to my wife Joanna who has kindly supported my working on various projects over the years. Thanks ------ -To all the great people from the various places I've worked over the -years, thank you. I've benefitted from your patience and insight and I -hope that some of what I've learned from you has been incorporated -into Megatest. - -Also, my thanks to all the wonderful open source creators. These -truly free projects, from Linux, xemacs, chicken scheme, and fossil to -asciidoc and bash are the philosophical and direct underpinnings of -the Megatest project. +Thank you the many people I've worked over the years who have +shared their knowledge and insights with me. + +Thanks also to the creators of the various open source projects that +Megatest is built on. These include Linux, xemacs, chicken scheme, +fossil and asciidoc. Without these projects something like Megatest +would be difficult or impossible to do. [preface] Preface ======= This book is organised as three sub-books; getting started, writing tests and reference. @@ -65,10 +61,30 @@ megatest uses the network filesystem to call home to your master sqlite3 database. include::getting_started.txt[] include::writing_tests.txt[] include::reference.txt[] + + +========================================================= +# logpro_file input_glob +# matching file(s) will be diff'd with previous run and logpro applied +# if PASS or WARN result from logpro then WAIVER state is set +# +[waivers] +waiver_1 logpro lookittmp.log + +[waiver_rules] + +# This builtin rule is the default if there is no .logpro file +# diff diff %file1% %file2% + +# This builtin rule is applied if a .logpro file exists +# logpro diff %file1% %file2% | logpro %waivername%.logpro %waivername%.html +========================================================= + + [appendix] Example Appendix ================ One or more optional appendixes go here at section level zero. ADDED docs/megatest-training.odp Index: docs/megatest-training.odp ================================================================== --- /dev/null +++ docs/megatest-training.odp cannot compute difference between binary files ADDED docs/megatest-training.pdf Index: docs/megatest-training.pdf ================================================================== --- /dev/null +++ docs/megatest-training.pdf cannot compute difference between binary files ADDED docs/new-dashboard.png Index: docs/new-dashboard.png ================================================================== --- /dev/null +++ docs/new-dashboard.png cannot compute difference between binary files ADDED example/megatest.config Index: example/megatest.config ================================================================== --- /dev/null +++ example/megatest.config @@ -0,0 +1,24 @@ +[fields] +PLATFORM TEXT +OS TEXT + +[setup] +# Adjust max_concurrent_jobs to limit parallel jobs +max_concurrent_jobs 50 + +# This is your link path, best to set it and then not change it +linktree #{getenv PWD}/linktree + +# Job tools control how your jobs are launched +[jobtools] +useshell yes +launcher nbfind + +# You can override environment variables for all your tests here +[env-override] +EXAMPLE_VAR example value + +# As you run more tests you may need to add additional disks +# the names are arbitrary but must be unique +[disks] +disk0 #{getenv PWD}/runs ADDED example/runconfigs.config Index: example/runconfigs.config ================================================================== --- /dev/null +++ example/runconfigs.config @@ -0,0 +1,6 @@ +[default] +ALLTESTS see this variable + +# Your variables here are grouped by targets [SYSTEM/RELEASE] +[SYSTEM_val/RELEASE_val] +ANOTHERVAR only defined if target is SYSTEM_val/RELEASE_val ADDED example/tests/checkspace/checkspace.logpro Index: example/tests/checkspace/checkspace.logpro ================================================================== --- /dev/null +++ example/tests/checkspace/checkspace.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/adequate space/) + ADDED example/tests/checkspace/checkspace.sh Index: example/tests/checkspace/checkspace.sh ================================================================== --- /dev/null +++ example/tests/checkspace/checkspace.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +freespace=`df -k $DIRECTORY | grep $DIRECTORY | awk '{print $4}'` +if [[ $freespace -lt $REQUIRED ]];then + echo "ERROR: insufficient space on $DIRECTORY" + exit 1 +else + echo "There is adequate space on $DIRECTORY" +fi ADDED example/tests/checkspace/testconfig Index: example/tests/checkspace/testconfig ================================================================== --- /dev/null +++ example/tests/checkspace/testconfig @@ -0,0 +1,9 @@ +# Add steps here. Format is "stepname script" +[ezsteps] +checkspace checkspace.sh + +# Iteration for your tests are controlled by the items section +[itemstable] +DIRECTORY /tmp /opt +REQUIRED 1000000 100000 + Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -473,32 +473,58 @@ ;; to the iteration. use pathname-directory to trim the path by one ;; level (if (not not-iterated) ;; i.e. iterated (let ((iterated-parent (pathname-directory (conc lnkpath "/" item-path)))) (debug:print-info 2 "Creating iterated parent " iterated-parent) - (create-directory iterated-parent #t))) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: Failed to create directory " iterated-parent ((condition-property-accessor 'exn 'message) exn) ", exiting") + (exit 1)) + (create-directory iterated-parent #t)))) - (if (symbolic-link? lnkpath) (delete-file lnkpath)) + (if (symbolic-link? lnkpath) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: Failed to remove symlink " lnkpath ((condition-property-accessor 'exn 'message) exn) ", exiting") + (exit 1)) + (delete-file lnkpath))) + (if (not (or (file-exists? lnkpath) (symbolic-link? lnkpath))) - (create-symbolic-link toptest-path lnkpath)) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: Failed to create symlink " lnkpath ((condition-property-accessor 'exn 'message) exn) ", exiting") + (exit 1)) + (create-symbolic-link toptest-path lnkpath))) ;; The toptest path has been created, the link to the test in the linktree has ;; been created. Now, if this is an iterated test the real test dir must be created (if (not not-iterated) ;; this is an iterated test (let ((lnktarget (conc lnkpath "/" item-path))) (debug:print 2 "Setting up sub test run area") (debug:print 2 " - creating run area in " test-path) - (create-directory test-path #t) ;; (system (conc "mkdir -p " test-path)) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: Failed to create directory " test-path ((condition-property-accessor 'exn 'message) exn) ", exiting") + (exit 1)) + (create-directory test-path #t)) (debug:print 2 " - creating link from: " test-path "\n" " to: " lnktarget) - ;; (create-directory lnkpath #t) ;; (system (conc "mkdir -p " lnkpath)) ;; If there is already a symlink delete it and recreate it. - (if (symbolic-link? lnktarget) (delete-file lnktarget)) - (if (not (file-exists? lnktarget)) (create-symbolic-link test-path lnktarget)))) + (handle-exceptions + exn + (begin + (debug:print 0 "ERROR: Failed to re-create link " linktarget ((condition-property-accessor 'exn 'message) exn) ", exiting") + (exit)) + (if (symbolic-link? lnktarget) (delete-file lnktarget)) + (if (not (file-exists? lnktarget)) (create-symbolic-link test-path lnktarget))))) ;; I suspect this section was deleting test directories under some ;; wierd sitations? This doesn't make sense - reenabling the rm -f ;; I honestly don't remember *why* this chunk was needed... ;; (let ((testlink (conc lnkpath "/" testname))) @@ -507,11 +533,19 @@ ;; (symbolic-link? testlink))) ;; (system (conc "rm -f " testlink))) ;; (system (conc "ln -sf " test-path " " testlink))) (if (directory? test-path) (begin - (let* ((cmd (conc "rsync -av" (if (debug:debug-mode 1) "" "q") " " test-src-path "/ " test-path "/")) + (let* ((ovrcmd (let ((cmd (config-lookup *configdat* "setup" "testcopycmd"))) + (if cmd + ;; substitute the TEST_SRC_PATH and TEST_TARG_PATH + (string-substitute "TEST_TARG_PATH" test-path + (string-substitute "TEST_SRC_PATH" test-src-path cmd)) + #f))) + (cmd (if ovrcmd + ovrcmd + (conc "rsync -av" (if (debug:debug-mode 1) "" "q") " " test-src-path "/ " test-path "/"))) (status (system cmd))) (if (not (eq? status 0)) (debug:print 2 "ERROR: problem with running \"" cmd "\""))) (list lnkpathf lnkpath )) (list #f #f)))) Index: megatest-version.scm ================================================================== --- megatest-version.scm +++ megatest-version.scm @@ -1,7 +1,7 @@ ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. (declare (unit megatest-version)) -(define megatest-version 1.54) +(define megatest-version 1.5404) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -30,10 +30,18 @@ (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "megatest-fossil-hash.scm") + +;; (use trace) +;; (trace db:teststep-set-status! +;; tests:test-set-status! +;; cdb:test-set-status-state +;; cdb:client-call +;; tests:check-waiver-eligibility) + (define help (conc " Megatest, documentation at http://chiselapp.com/user/kiatoa/repository/megatest version " megatest-version " license GPL, Copyright Matt Welland 2006-2012 @@ -116,12 +124,12 @@ -pathmod path : insert path, i.e. path/runame/itempath/logfile.html will clear the field if no rundir/testname/itempath/logfile if it contains forward slashes the path will be converted to windows style Getting started - -gen-megatest-area : create a skeleton megatest area. You will be prompted for paths - -gen-megatest-test : create a skeleton megatest test. You will be prompted for info + -gen-megatest-area : create a skeleton megatest area. You will be prompted for paths + -gen-megatest-test tname : create a skeleton megatest test. You will be prompted for info Examples # Get test path, use '.' to get a single path or a specific path/file pattern megatest -test-files 'logs/*.log' -target ubuntu/n%/no% :runname w49% -testpatt test_mt% ADDED mkdeploy/megatest.config Index: mkdeploy/megatest.config ================================================================== --- /dev/null +++ mkdeploy/megatest.config @@ -0,0 +1,30 @@ +[fields] +PLATFORM TEXT +OS TEXT +OSVER TEXT + +[setup] +# Adjust max_concurrent_jobs to limit parallel jobs +max_concurrent_jobs 20 + +# This is your link path, best to set it and then not change it +linktree #{getenv MT_RUN_AREA_HOME}/linktree + +# Job tools control how your jobs are launched +[jobtools] +useshell yes +launcher nbfind + +# As you run more tests you may need to add additional disks +# the names are arbitrary but must be unique +# +[disks] +disk0 #{getenv MT_RUN_AREA_HOME}/runs + +# put env-override last so definitions in site.config by default +# are added as env-override variables +# +[env-override] + +# if the file site.config exists it will be used +[include site.config] ADDED mkdeploy/runconfigs.config Index: mkdeploy/runconfigs.config ================================================================== --- /dev/null +++ mkdeploy/runconfigs.config @@ -0,0 +1,9 @@ +[default] +TARGDIR_tmp /tmp +TARGDIR_opt /opt +TARGDIR_runs #{getenv MT_RUN_AREA_HOME}/runs +BUILDDIR #{getenv MT_RUN_AREA_HOME}/.. + +# Your variables here are grouped by targets [SYSTEM/RELEASE] +[SYSTEM_val/RELEASE_val] +ANOTHERVAR only defined if target is SYSTEM_val/RELEASE_val ADDED mkdeploy/tests/checkspace/checkspace.logpro Index: mkdeploy/tests/checkspace/checkspace.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/checkspace/checkspace.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/adequate space/) + ADDED mkdeploy/tests/checkspace/checkspace.sh Index: mkdeploy/tests/checkspace/checkspace.sh ================================================================== --- /dev/null +++ mkdeploy/tests/checkspace/checkspace.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +freespace=`df -k /$DIRECTORY | grep $DIRECTORY | awk '{print $4}'` +if [[ $freespace -lt $REQUIRED ]];then + echo "ERROR: insufficient space on /$DIRECTORY" + exit 1 +else + echo "There is adequate space on /$DIRECTORY" +fi ADDED mkdeploy/tests/checkspace/testconfig Index: mkdeploy/tests/checkspace/testconfig ================================================================== --- /dev/null +++ mkdeploy/tests/checkspace/testconfig @@ -0,0 +1,11 @@ +# Add steps here. Format is "stepname script" +[ezsteps] +checkspace checkspace.sh + +# Iteration for your tests are controlled by the items section +# However it is impractical to code the actual directory here +# so use names here and dereference to variables in runconfigs +[itemstable] +DIRECTORY tmp opt runs +REQUIRED 100000 100000 1000000 + ADDED mkdeploy/tests/eggs/install.logpro Index: mkdeploy/tests/eggs/install.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/eggs/install.logpro @@ -0,0 +1,5 @@ +(expect:ignore in "LogFileBody" >= 0 "ignore setup-error-handling" #/setup-error-handling/) +(expect:ignore in "LogFileBody" >= 0 "ignore check-errors" (list #/check-errors/ #/type-errors/ #/srfi-4-errors/)) +(expect:error in "LogFileBody" = 0 "Any error" #/error/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/DONE/) + ADDED mkdeploy/tests/eggs/install.sh Index: mkdeploy/tests/eggs/install.sh ================================================================== --- /dev/null +++ mkdeploy/tests/eggs/install.sh @@ -0,0 +1,4 @@ +#!/bin/bash -e +targpath=`megatest -test-paths -target $MT_TARGET :runname $MT_RUNNAME -testpatt executables/megatest` +chicken-install -prefix $targpath/megatest -deploy $EGGNAME +echo DONE ADDED mkdeploy/tests/eggs/testconfig Index: mkdeploy/tests/eggs/testconfig ================================================================== --- /dev/null +++ mkdeploy/tests/eggs/testconfig @@ -0,0 +1,12 @@ +# Add steps here. Format is "stepname script" +[ezsteps] +install install.sh + +[requirements] +waiton executables + +# Iteration for your tests are controlled by the items section +# However it is impractical to code the actual directory here +# so use names here and dereference to variables in runconfigs +[items] +EGGNAME apropos base64 canvas-draw csv-xml directory-utils dot-locking extras fmt format hostinfo http-client intarweb json md5 message-digest posix posix-extras readline regex regex-case s11n spiffy spiffy-request-vars sqlite3 srfi-1 srfi-18 srfi-69 tcp test uri-common zmq check-errors synch matchable sql-null tcp-server rpc blob-utils string-utils variable-item defstruct uri-generic sendfile openssl lookup-table list-utils stack ADDED mkdeploy/tests/executables/addlibs.logpro Index: mkdeploy/tests/executables/addlibs.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/executables/addlibs.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/libchicken.so.6/) + ADDED mkdeploy/tests/executables/addlibs.sh Index: mkdeploy/tests/executables/addlibs.sh ================================================================== --- /dev/null +++ mkdeploy/tests/executables/addlibs.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +CSIPATH=$(echo $(type csi)|awk '{print $3}') +CKPATH=$(dirname $(dirname $CSIPATH)) +rsync -av $EXECUTABLE/ ../deploytarg/ +for i in iup im cd av call sqlite; do + cp $(CKPATH)/lib/lib$i* ../deploytarg/ +done + +cp $(CKPATH)/include/*.h ../deploytarg/ ADDED mkdeploy/tests/executables/install.logpro Index: mkdeploy/tests/executables/install.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/executables/install.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/libchicken.so.6/) + ADDED mkdeploy/tests/executables/install.sh Index: mkdeploy/tests/executables/install.sh ================================================================== --- /dev/null +++ mkdeploy/tests/executables/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +unset LD_LIBRARY_PATH +rm -rf $EXECUTABLE +mkdir $EXECUTABLE +csc -deploy $EXECUTABLE +ls $EXECUTABLE ADDED mkdeploy/tests/executables/linksrc.logpro Index: mkdeploy/tests/executables/linksrc.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/executables/linksrc.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/Makefile/) + ADDED mkdeploy/tests/executables/linksrc.sh Index: mkdeploy/tests/executables/linksrc.sh ================================================================== --- /dev/null +++ mkdeploy/tests/executables/linksrc.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +rm -f *.scm *.o Makefile +ln -s $BUILDDIR/*.scm . +ln -s $BUILDDIR/Makefile . +ls Makefile *.scm ADDED mkdeploy/tests/executables/make_mt.logpro Index: mkdeploy/tests/executables/make_mt.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/executables/make_mt.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/mtest/) + ADDED mkdeploy/tests/executables/testconfig Index: mkdeploy/tests/executables/testconfig ================================================================== --- /dev/null +++ mkdeploy/tests/executables/testconfig @@ -0,0 +1,13 @@ +# Add steps here. Format is "stepname script" +[ezsteps] +linksrc linksrc.sh +make_mt make +install install.sh +addlibs addlibs.sh + +# Iteration for your tests are controlled by the items section +# However it is impractical to code the actual directory here +# so use names here and dereference to variables in runconfigs +[itemstable] +EXECUTABLE megatest dashboard + ADDED mkdeploy/tests/helpers/install.logpro Index: mkdeploy/tests/helpers/install.logpro ================================================================== --- /dev/null +++ mkdeploy/tests/helpers/install.logpro @@ -0,0 +1,3 @@ +(expect:error in "LogFileBody" = 0 "Any error" #/err/i) +(expect:required in "LogFileBody" = 1 "Sucess signature" #/adequate space/) + ADDED mkdeploy/tests/helpers/install.sh Index: mkdeploy/tests/helpers/install.sh ================================================================== --- /dev/null +++ mkdeploy/tests/helpers/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +freespace=`df -k /$DIRECTORY | grep $DIRECTORY | awk '{print $4}'` +if [[ $freespace -lt $REQUIRED ]];then + echo "ERROR: insufficient space on /$DIRECTORY" + exit 1 +else + echo "There is adequate space on /$DIRECTORY" +fi ADDED mkdeploy/tests/helpers/testconfig Index: mkdeploy/tests/helpers/testconfig ================================================================== --- /dev/null +++ mkdeploy/tests/helpers/testconfig @@ -0,0 +1,11 @@ +# Add steps here. Format is "stepname script" +[ezsteps] +install install.sh + +# Iteration for your tests are controlled by the items section +# However it is impractical to code the actual directory here +# so use names here and dereference to variables in runconfigs +[itemstable] +DIRECTORY tmp opt runs +REQUIRED 100000 100000 1000000 + Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -256,16 +256,27 @@ (if (not (null? test-names)) (let loop ((hed (car test-names)) (tal (cdr test-names))) ;; 'return-procs tells the config reader to prep running system but return a proc (debug:print-info 4 "hed=" hed " at top of loop") (let* ((config (tests:get-testconfig hed 'return-procs)) - (waitons (if config (string-split (let ((w (config-lookup config "requirements" "waiton"))) - (if w w ""))) - (begin - (debug:print 0 "ERROR: non-existent required test \"" hed "\"") - (if db (sqlite3:finalize! db)) - (exit 1))))) + (waitons (let ((instr (if config + (config-lookup config "requirements" "waiton") + (begin ;; No config means this is a non-existant test + (debug:print 0 "ERROR: non-existent required test \"" hed "\"") + (if db (sqlite3:finalize! db)) + (exit 1))))) + (debug:print-info 8 "waitons string is " instr) + (string-split (cond + ((procedure? instr) + (let ((res (instr))) + (debug:print-info 8 "waiton procedure results in string " res " for test " hed) + res)) + ((string? instr) instr) + (else + ;; NOTE: This is actually the case of *no* waitons! ;; (debug:print 0 "ERROR: something went wrong in processing waitons for test " hed) + "")))))) + (debug:print-info 8 "waitons: " waitons) ;; check for hed in waitons => this would be circular, remove it and issue an ;; error (if (member hed waitons) (begin (debug:print 0 "ERROR: test " hed " has listed itself as a waiton, please correct this!") @@ -817,15 +828,21 @@ (debug:print 0 "WARNING: directory " real-dir " does not exist") (debug:print 0 "WARNING: no real directory corrosponding to link " run-dir ", nothing done"))) (if (symbolic-link? run-dir) (begin (debug:print-info 1 "Removing symlink " run-dir) - (delete-file run-dir)) + (handle-exceptions + exn + (debug:print 0 "ERROR: Failed to remove symlink " run-dir ((condition-property-accessor 'exn 'message) exn) ", attempting to continue") + (delete-file run-dir))) (if (directory? run-dir) (if (> (directory-fold (lambda (f x)(+ 1 x)) 0 run-dir) 0) (debug:print 0 "WARNING: refusing to remove " run-dir " as it is not empty") - (delete-directory run-dir)) ;; it should be empty by here BUG BUG, add error catch + (handle-exceptions + exn + (debug:print 0 "ERROR: Failed to remove directory " run-dir ((condition-property-accessor 'exn 'message) exn) ", attempting to continue") + (delete-directory run-dir))) (if run-dir (debug:print 0 "WARNING: not removing " run-dir " as it either doesn't exist or is not a symlink") (debug:print 0 "NOTE: the run dir for this test is undefined. Test may have already been deleted.")) ))) ((set-state-status) Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -11,11 +11,11 @@ ;;====================================================================== ;; Tests ;;====================================================================== -(use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp) +(use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp directory-utils) (import (prefix sqlite3 sqlite3:)) (declare (unit tests)) (declare (uses db)) (declare (uses common)) @@ -185,10 +185,67 @@ (hash-table-set! tests-hash full-testname testdat)))) results) (if (null? tal) (map cdr (hash-table->alist tests-hash)) ;; return a list of the most recent tests (loop (car tal)(cdr tal)))))))))) + +;; Check for waiver eligibility +;; +(define (tests:check-waiver-eligibility testdat prev-testdat) + (let* ((testconfig (tests:get-testconfig (db:test-get-testname testdat) #f)) + (test-rundir (db:test-get-rundir testdat)) + (prev-rundir (db:test-get-rundir prev-testdat)) + (waivers (configf:section-vars testconfig "waivers")) + (waiver-rx (regexp "^(\\S+)\\s+(.*)$")) + (diff-rule "diff %file1% %file2%") + (logpro-rule "diff %file1% %file2% | logpro %waivername%.logpro %waivername%.html")) + (push-directory test-rundir) + (let ((result (if (null? waivers) + #f + (let loop ((hed (car waivers)) + (tal (cdr waivers))) + (debug:print 0 "INFO: Applying waiver rule \"" hed "\"") + (let* ((waiver (configf:lookup testconfig "waivers" hed)) + (wparts (if waiver (string-match waiver-rx waiver) #f)) + (waiver-rule (if wparts (cadr wparts) #f)) + (waiver-glob (if wparts (caddr wparts) #f)) + (logpro-file (if waiver + (let ((fname (conc hed ".logpro"))) + (if (file-exists? fname) + fname + (begin + (debug:print 0 "INFO: No logpro file " fname " falling back to diff") + #f))) + #f)) + ;; if rule by name of waiver-rule is found in testconfig - use it + ;; else if waivername.logpro exists use logpro-rule + ;; else default to diff-rule + (rule-string (let ((rule (configf:lookup testconfig "waiver_rules" waiver-rule))) + (if rule + rule + (if logpro-file + logpro-rule + (begin + (debug:print 0 "INFO: No logpro file " logpro-file " found, using diff rule") + diff-rule))))) + ;; (string-substitute "%file1%" "foofoo.txt" "This is %file1% and so is this %file1%." #t) + (processed-cmd (string-substitute + "%file1%" (conc test-rundir "/" waiver-glob) + (string-substitute + "%file2%" (conc prev-rundir "/" waiver-glob) + (string-substitute + "%waivername%" hed rule-string #t) #t) #t)) + (res #f)) + (debug:print 0 "INFO: waiver command is \"" processed-cmd "\"") + (if (eq? (system processed-cmd) 0) + (if (null? tal) + #t + (loop (car tal)(cdr tal))) + #f)))))) + (pop-directory) + result))) + ;; Do not rpc this one, do the underlying calls!!! (define (tests:test-set-status! test-id state status comment dat) (debug:print-info 4 "tests:test-set-status! test-id=" test-id ", state=" state ", status=" status ", dat=" dat) (let* ((db #f) @@ -198,29 +255,41 @@ (run-id (db:test-get-run_id testdat)) (test-name (db:test-get-testname testdat)) (item-path (db:test-get-item-path testdat)) ;; before proceeding we must find out if the previous test (where all keys matched except runname) ;; was WAIVED if this test is FAIL - (waived (if (equal? status "FAIL") - (let ((prev-test (open-run-close test:get-previous-test-run-record db run-id test-name item-path))) - (if prev-test ;; true if we found a previous test in this run series - (let ((prev-status (db:test-get-status prev-test)) - (prev-state (db:test-get-state prev-test)) - (prev-comment (db:test-get-comment prev-test))) - (debug:print 4 "prev-status " prev-status ", prev-state " prev-state ", prev-comment " prev-comment) - (if (and (equal? prev-state "COMPLETED") - (equal? prev-status "WAIVED")) - prev-comment ;; waived is either the comment or #f - #f)) - #f)) + + ;; NOTES: + ;; 1. Is the call to test:get-previous-run-record remotified? + ;; 2. Add test for testconfig waiver propagation control here + ;; + (prev-test (if (equal? status "FAIL") + (open-run-close test:get-previous-test-run-record db run-id test-name item-path) + #f)) + (waived (if prev-test + (if prev-test ;; true if we found a previous test in this run series + (let ((prev-status (db:test-get-status prev-test)) + (prev-state (db:test-get-state prev-test)) + (prev-comment (db:test-get-comment prev-test))) + (debug:print 4 "prev-status " prev-status ", prev-state " prev-state ", prev-comment " prev-comment) + (if (and (equal? prev-state "COMPLETED") + (equal? prev-status "WAIVED")) + (if comment + comment + prev-comment) ;; waived is either the comment or #f + #f)) + #f) #f))) - (if waived (set! real-status "WAIVED")) + (if (and waived + (tests:check-waiver-eligibility testdat prev-test)) + (set! real-status "WAIVED")) + (debug:print 4 "real-status " real-status ", waived " waived ", status " status) ;; update the primary record IF state AND status are defined (if (and state status) - (cdb:test-set-status-state *runremote* test-id real-status state #f)) + (cdb:test-set-status-state *runremote* test-id real-status state (if waived waived comment))) ;; if status is "AUTO" then call rollup (note, this one modifies data in test ;; run area, it does remote calls under the hood. (if (and test-id state status (equal? status "AUTO")) (db:test-data-rollup #f test-id status)) Index: tests/fullrun/megatest.config ================================================================== --- tests/fullrun/megatest.config +++ tests/fullrun/megatest.config @@ -9,10 +9,21 @@ area1 /tmp/oldarea/megatest [include #{getenv MT_RUN_AREA_HOME}/config/mt_include_1.config] [setup] + +# It is possible (but not recommended) to override the rsync command used +# to populate the test directories. For test development the following +# example can be useful +# +testcopycmd cp --remove-destination -rsv TEST_SRC_PATH/. TEST_TARG_PATH/. + +# or for hard links + +# testcopycmd cp --remove-destination -rlv TEST_SRC_PATH/ TEST_TARG_PATH/ + # FULL or 2, NORMAL or 1, OFF or 0 synchronous OFF # Throttle roughly scales the db access milliseconds to seconds delay throttle 0.2 # Max retries allows megatest to re-check that a tests status has changed Index: tests/fullrun/tests/ezlog_fail/testconfig ================================================================== --- tests/fullrun/tests/ezlog_fail/testconfig +++ tests/fullrun/tests/ezlog_fail/testconfig @@ -2,10 +2,25 @@ [ezsteps] lookittmp ls /tmp lookithome ls /home +# logpro_file input_glob +# matching file(s) will be diff'd with previous run and logpro applied +# if PASS or WARN result from logpro then WAIVER state is set +# +[waivers] +waiver_1 logpro lookittmp.log + +[waiver_rules] + +# This builtin rule is the default if there is no .logpro file +# diff diff %file1% %file2% + +# This builtin rule is applied if a .logpro file exists +# logpro diff %file1% %file2% | logpro %waivername%.logpro %waivername%.html + [test_meta] author matt owner bob description This test runs two ezstep, the first of which is expected to fail using a simple logpro file. ADDED tests/fullrun/tests/ezlog_fail/waiver_1.logpro Index: tests/fullrun/tests/ezlog_fail/waiver_1.logpro ================================================================== --- /dev/null +++ tests/fullrun/tests/ezlog_fail/waiver_1.logpro @@ -0,0 +1,1 @@ +(expect:warning in "Body" = 0 "Any warning" #/WARNING/) Index: utils/mk_wrapper ================================================================== --- utils/mk_wrapper +++ utils/mk_wrapper @@ -8,6 +8,6 @@ echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" fi fullcmd="$prefix/bin/$cmd" -echo "$fullcmd \$*" +echo "$fullcmd \"\$@\""