Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -20,20 +20,20 @@ MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}') CSIPATH=$(shell which csi) CKPATH=$(shell dirname $(shell dirname $(CSIPATH))) -all : mtest dboard newdashboard +all : mtest dboard newdboard mtest: $(OFILES) megatest.o csc $(CSCOPTS) $(OFILES) megatest.o -o mtest dboard : $(OFILES) $(GOFILES) dashboard.scm csc $(OFILES) dashboard.scm $(GOFILES) -o dboard -newdashboard : newdashboard.scm $(OFILES) - csc $(OFILES) newdashboard.scm -o newdashboard +newdboard : newdashboard.scm $(OFILES) $(GOFILES) + csc $(OFILES) $(GOFILES) newdashboard.scm -o newdboard deploytarg/libiupcd.so : $(CKPATH)/lib/libiupcd.so for i in iup im cd av call sqlite; do \ cp $(CKPATH)/lib/lib$$i* deploytarg/ ; \ done @@ -70,12 +70,14 @@ @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 +$(PREFIX)/bin/newdboard : newdboard + $(INSTALL) newdboard $(PREFIX)/bin/newdboard + utils/mk_wrapper $(PREFIX) newdboard > $(PREFIX)/bin/newdashboard + chmod a+x $(PREFIX)/bin/newdashboard $(HELPERS) : utils/mt_* $(INSTALL) $< $@ chmod a+x $@ @@ -104,11 +106,11 @@ $(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 $(PREFIX)/bin/newdashboard +install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdboard 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 Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -146,10 +146,16 @@ "disks" '("none" ""))) ;;====================================================================== ;; System stuff ;;====================================================================== + +;; return a nice clean pathname made absolute +(define (nice-path dir) + (normalize-pathname (if (absolute-pathname? dir) + dir + (conc (current-directory) "/" dir)))) (define (get-df path) (let* ((df-results (cmd-run->list (conc "df " path))) (space-rx (regexp "([0-9]+)\\s+([0-9]+)%")) (freespc #f)) Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -11,11 +11,11 @@ ;;====================================================================== ;; Config file handling ;;====================================================================== -(use regex regex-case) +(use regex regex-case directory-utils) (declare (unit configf)) (declare (uses common)) (declare (uses process)) (include "common_records.scm") @@ -130,11 +130,11 @@ ;; sections: #f => get all, else list of sections to gather (define (read-config path ht allow-system #!key (environ-patt #f)(curr-section #f)(sections #f)) (debug:print-info 5 "read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section " sections: " sections " pwd: " (current-directory)) (if (not (file-exists? path)) (begin - (debug:print-info 4 "read-config - file not found " path " current path: " (current-directory)) + (debug:print-info 1 "read-config - file not found " path " current path: " (current-directory)) (if (not ht)(make-hash-table) ht)) (let ((inp (open-input-file path)) (res (if (not ht)(make-hash-table) ht))) (let loop ((inl (configf:read-line inp res allow-system)) ;; (read-line inp)) (curr-section-name (if curr-section curr-section "default")) @@ -148,16 +148,28 @@ res) (regex-case inl (configf:comment-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) (configf:blank-l-rx _ (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) - (configf:include-rx ( x include-file ) (let ((curr-dir (current-directory)) - (conf-dir (pathname-directory path))) - (if conf-dir (change-directory conf-dir)) - (read-config include-file res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections) - (change-directory curr-dir) - (loop (configf:read-line inp res allow-system) curr-section-name #f #f))) + (configf:include-rx ( x include-file ) (let* ((curr-conf-dir (pathname-directory path)) + (full-conf (if (absolute-pathname? include-file) + include-file + (nice-path + (conc (if curr-conf-dir + curr-conf-dir + ".") + "/" include-file))))) + (if (file-exists? full-conf) + (begin + ;; (push-directory conf-dir) + (read-config full-conf res allow-system environ-patt: environ-patt curr-section: curr-section-name sections: sections) + ;; (pop-directory) + (loop (configf:read-line inp res allow-system) curr-section-name #f #f)) + (begin + (debug:print 2 "INFO: include file " include-file " not found (called from " path ")") + (debug:print 2 " " full-conf) + (loop (configf:read-line inp res allow-system) curr-section-name #f #f))))) (configf:section-rx ( x section-name ) (loop (configf:read-line inp res allow-system) ;; if we have the sections list then force all settings into "" and delete it later? (if (or (not sections) (member section-name sections)) section-name "") ;; stick everything into "" Index: docs/manual/megatest_manual.txt ================================================================== --- docs/manual/megatest_manual.txt +++ docs/manual/megatest_manual.txt @@ -63,17 +63,25 @@ include::getting_started.txt[] include::writing_tests.txt[] include::reference.txt[] +Controlled waiver propagation +============================= +If test is FAIL and previous test in run with same MT_TARGET is WAIVED then apply the following rules from the testconfig: +If a waiver check is specified in the testconfig apply the check and if it passes then set this FAIL to WAIVED + +Waiver check has two parts, 1) a list of waiver, rulename, filepatterns and 2) the rulename script spec (note that "diff" and "logpro" are predefined) + ========================================================= -# logpro_file input_glob +###### EXAMPLE FROM testconfig ######### # 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 +# logpro_file rulename input_glob +waiver_1 logpro lookittmp.log [waiver_rules] # This builtin rule is the default if there is no .logpro file # diff diff %file1% %file2% Index: docs/megatest-training.odp ================================================================== --- docs/megatest-training.odp +++ docs/megatest-training.odp cannot compute difference between binary files Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -274,11 +274,12 @@ (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) (debug:print-info 2 "Starting the standalone server") - (daemon:ize) + (if (args:get-arg "-daemonize") + (daemon:ize)) (let ((hostinfo (open-run-close tasks:get-best-server tasks:open-db))) (debug:print 11 "http-transport:launch hostinfo=" hostinfo) ;; #(1 "143.182.207.24" 5736 -1 "http" 22771 "hostname") (if hostinfo (debug:print-info 2 "NOT starting new server, one is already running on " (vector-ref hostinfo 1) ":" (vector-ref hostinfo 2)) 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.5405) +(define megatest-version 1.5409) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -31,20 +31,35 @@ (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) +;; (use trace dot-locking) +;; (trace +;; thread-sleep! +;; sqlite3:execute +;; sqlite3:for-each-row +;; open-run-close +;; runs:can-run-more-tests +;; cdb:remote-run +;; nice-path +;; read-config +;; db:teststep-set-status! +;; tests:test-set-status! +;; cdb:test-set-status-state +;; cdb:client-call +;; tests:check-waiver-eligibility +;; tests:summarize-items +;; db:test-get-logfile-info +;; obtain-dot-lock +;; change-directory +;; cdb:remote-run +;; ) (define help (conc " -Megatest, documentation at http://chiselapp.com/user/kiatoa/repository/megatest +Megatest, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright Matt Welland 2006-2012 Usage: megatest [options] -h : this help @@ -113,10 +128,11 @@ -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -server -|hostname : start the server (reduces contention on megatest.db), use - to automatically figure out hostname -transport http|zmq : use http or zmq for transport (default is http) + -daemonize : fork into background and disconnect from stdin/out -list-servers : list the servers -repl : start a repl (useful for extending megatest) -load file.scm : load and run file.scm Spreadsheet generation @@ -201,10 +217,11 @@ "-test-status" "-set-values" "-load-test-data" "-summarize-items" "-gui" + "-daemonize" ;; misc "-archive" "-repl" "-lock" "-unlock" @@ -302,11 +319,11 @@ (if (or (not servers) (null? servers)) (begin (debug:print 0 "INFO: Starting server as none running ...") ;; (server:launch (string->symbol (args:get-arg "-transport" "http")))) - (system (conc (car (argv)) " -server - -transport " (args:get-arg "-transport" "http"))) + (system (conc (car (argv)) " -server - -daemonize -transport " (args:get-arg "-transport" "http"))) (thread-sleep! 3)) ;; give the server a few seconds to start (debug:print 0 "INFO: Servers already running " servers) ))))) @@ -393,11 +410,11 @@ (else (debug:print 0 "ERROR: -dumpmode of " (args:get-arg "-dumpmode") " not recognised"))) (set! *didsomething* #t))) (if (args:get-arg "-show-config") - (let ((data (read-config "megatest.config" #f #t))) + (let ((data *configdat*)) ;; (read-config "megatest.config" #f #t))) ;; keep this one local (cond ((not (args:get-arg "-dumpmode")) (pp (hash-table->alist data))) ((string=? (args:get-arg "-dumpmode") "json") Index: runconfig.scm ================================================================== --- runconfig.scm +++ runconfig.scm @@ -1,11 +1,11 @@ ;;====================================================================== ;; read a config file, loading only the section pertinent ;; to this run field1val/field2val/field3val ... ;;====================================================================== -(use format) +(use format directory-utils) (declare (unit runconfig)) (declare (uses common)) (include "common_records.scm") @@ -60,17 +60,19 @@ (debug:print 2 "---") (set! *already-seen-runconfig-info* #t))) finaldat)) (define (set-run-config-vars db run-id keys keyvals) + (push-directory *toppath*) (let ((runconfigf (conc *toppath* "/runconfigs.config")) (targ (or (args:get-arg "-target") (args:get-arg "-reqtarg") (db:get-target db run-id)))) + (pop-directory) (if (file-exists? runconfigf) (setup-env-defaults runconfigf run-id #t keys keyvals environ-patt: (conc "(default" (if targ (conc "|" targ ")") ")"))) (debug:print 0 "WARNING: You do not have a run config file: " runconfigf)))) Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -352,18 +352,17 @@ (orig-dir (current-directory)) (logf-info (cdb:remote-run db:test-get-logfile-info #f run-id test-name)) (logf (if logf-info (cadr logf-info) #f)) (path (if logf-info (car logf-info) #f))) ;; This query finds the path and changes the directory to it for the test - (set! logf (car logf-info)) (if (directory? path) (begin (debug:print 4 "Found path: " path) (change-directory path)) ;; (set! outputfilename (conc path "/" outputfilename))) (print "No such path: " path)) - (debug:print 1 "summarize-items with logf " logf) + (debug:print 4 "summarize-items with logf " logf ", outputfilename " outputfilename " and force " force) (if (or (equal? logf "logs/final.log") (equal? logf outputfilename) force) (begin (if (obtain-dot-lock outputfilename 1 20 30) ;; retry every second for 20 seconds, call it dead after 30 seconds and steal the lock Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -13,12 +13,12 @@ OS = $(shell grep ID /etc/*-release|cut -d= -f2) FS = $(shell df -T .|tail -1|awk '{print $$2}') VER = $(shell fsl info|grep checkout|awk '{print $$2}'|cut -c 1-5) # The NEWTARGET causes some tests to fail. Do not use until this is fixed. -NEWTARGET = "-target $(OS)/$(FS)/$(VER)" -TARGET = "-target ubuntu/nfs/none" +NEWTARGET = "$(OS)/$(FS)/$(VER)" +TARGET = "ubuntu/nfs/none" all : test1 test2 test3 test4 test5 server : (cd ..;make;make install) && \ @@ -34,11 +34,11 @@ cd simplerun;cp ../../*_records.scm .;perl -pi.bak -e 's/define-inline/define/' *_records.scm cd simplerun;echo '(load "../tests.scm")' | $(MEGATEST) -repl -debug $(DEBUG) test2 : fullprep cd fullrun;$(MEGATEST) -runtests ez_pass,runfirst/a/% -reqtarg ubuntu/nfs/none :runname $(RUNNAME) -debug $(DEBUG) $(LOGGING) - cd fullrun;megatest -runall -target ubuntu/nfs/none :runname $(RUNNAME)_01 -testpatt %/,%/ai -debug $(DEBUG) + cd fullrun;megatest -runtests % -target ubuntu/nfs/none :runname $(RUNNAME)_01 -testpatt %/,%/ai -debug $(DEBUG) cd fullrun;megatest -runtests %/,%/ai -target ubuntu/nfs/none :runname $(RUNAME)_02 -debug $(DEBUG) cd fullrun;megatest -runtests runfirst/%,%/ai -target ubuntu/nfs/none :runname $(RUNNAME)_02 -debug $(DEBUG) cd fullrun;megatest -runtests %/,%/winter -target ubuntu/nfs/none :runname $(RUNNAME)_03 -debug $(DEBUG) sleep 40;cd fullrun;megatest -target ubuntu/nfs/none :runname $(RUNNAME) -set-state-status COMPLETED,FORCED :state COMPLETED :status PASS -testpatt ez_p%s,runfirst/ -debug $(DEBUG) $(LOGGING) @@ -49,16 +49,16 @@ test4 : fullprep cd fullrun;$(MEGATEST) -debug $(DEBUG) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_b -m "This is a comment specific to a run" -v $(LOGGING) # NOTE: Only one instance can be a server test5 : fullprep - cd fullrun;sleep 0;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_aa -debug $(DEBUG) $(LOGGING) > aa.log 2> aa.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ab -debug $(DEBUG) $(LOGGING) > ab.log 2> ab.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ac -debug $(DEBUG) $(LOGGING) > ac.log 2> ac.log & - cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ad -debug $(DEBUG) $(LOGGING) > ad.log 2> ad.log & - # cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_ae -debug $(DEBUG) $(LOGGING) > ae.log 2> ae.log & - # cd fullrun;sleep 10;$(MEGATEST) -runall $(TARGET) :runname $(RUNNAME)_af -debug $(DEBUG) $(LOGGING) > af.log 2> af.log & + cd fullrun;sleep 0;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_aa -debug $(DEBUG) $(LOGGING) > aa.log 2> aa.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ab -debug $(DEBUG) $(LOGGING) > ab.log 2> ab.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ac -debug $(DEBUG) $(LOGGING) > ac.log 2> ac.log & + cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ad -debug $(DEBUG) $(LOGGING) > ad.log 2> ad.log & +# cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_ae -debug $(DEBUG) $(LOGGING) > ae.log 2> ae.log & +# cd fullrun;sleep 10;$(MEGATEST) -runtests % -target $(TARGET) :runname $(RUNNAME)_af -debug $(DEBUG) $(LOGGING) > af.log 2> af.log & test6: fullprep cd fullrun;$(MEGATEST) -runtests runfirst -testpatt %/1 -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -v cd fullrun;$(MEGATEST) -runtests runfirst -testpatt %blahha% -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -debug 10 cd fullrun;$(MEGATEST) -rollup :runname newrun -target ubuntu/nfs/none -debug 10 ADDED tests/fdktestqa/fdk.config Index: tests/fdktestqa/fdk.config ================================================================== --- /dev/null +++ tests/fdktestqa/fdk.config @@ -0,0 +1,12 @@ +[fields] +SYSTEM TEXT +RELEASE TEXT + +[setup] +# Adjust max_concurrent_jobs to limit how much you load your machines +max_concurrent_jobs 500 + +# This is your link path, you can move it but it is generally better to keep it stable +linktree #{shell readlink -f #{getenv PWD}/../simplelinks} + +[include testqa/configs/megatest.abc.config] ADDED tests/fdktestqa/testqa/configs/megatest.abc.config Index: tests/fdktestqa/testqa/configs/megatest.abc.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/configs/megatest.abc.config @@ -0,0 +1,10 @@ +# Valid values for state and status for steps, NB// It is not recommended you use this +[validvalues] +state start end completed + +# Job tools are more advanced ways to control how your jobs are launched +[jobtools] +useshell yes +launcher nbfake + +[include megatest.def.config] ADDED tests/fdktestqa/testqa/configs/megatest.def.config Index: tests/fdktestqa/testqa/configs/megatest.def.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/configs/megatest.def.config @@ -0,0 +1,8 @@ +# 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 #{scheme (nice-path "#{getenv PWD}/../simpleruns")} + ADDED tests/fdktestqa/testqa/megatest.config Index: tests/fdktestqa/testqa/megatest.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/megatest.config @@ -0,0 +1,5 @@ +[setup] +testcopycmd cp --remove-destination -rlv TEST_SRC_PATH/. TEST_TARG_PATH/. + +[include ../fdk.config] + ADDED tests/fdktestqa/testqa/runconfigs.config Index: tests/fdktestqa/testqa/runconfigs.config ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/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 tests/fdktestqa/testqa/tests/bigrun/step1.sh Index: tests/fdktestqa/testqa/tests/bigrun/step1.sh ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/tests/bigrun/step1.sh @@ -0,0 +1,3 @@ +#!/bin/sh +sleep 100 +exit 0 ADDED tests/fdktestqa/testqa/tests/bigrun/testconfig Index: tests/fdktestqa/testqa/tests/bigrun/testconfig ================================================================== --- /dev/null +++ tests/fdktestqa/testqa/tests/bigrun/testconfig @@ -0,0 +1,20 @@ +# Add additional steps here. Format is "stepname script" +[ezsteps] +step1 step1.sh + +# Test requirements are specified here +[requirements] +# waiton setup +priority 0 + +# Iteration for your tests are controlled by the items section +[items] +NUMBER #{scheme (string-intersperse (map number->string (sort (let loop ((a 0)(res '()))(if (< a 500)(loop (+ a 1)(cons a res)) res)) >)) " ")} + +# test_meta is a section for storing additional data on your test +[test_meta] +author matt +owner matt +description An example test +tags tagone,tagtwo +reviewed never Index: tests/fullrun/megatest.config ================================================================== --- tests/fullrun/megatest.config +++ tests/fullrun/megatest.config @@ -6,11 +6,11 @@ # refareas can be searched to find previous runs # the path points to where megatest.db exists [refareas] area1 /tmp/oldarea/megatest -[include #{getenv MT_RUN_AREA_HOME}/config/mt_include_1.config] +[include 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 @@ -18,11 +18,11 @@ # 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/ +# 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