Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -1004,12 +1004,14 @@ ;; all prereqs must be met: ;; if prereq test with itempath='' is COMPLETED and PASS, WARN, CHECK, or WAIVED then prereq is met ;; if prereq test with itempath=ref-item-path and COMPLETED with PASS, WARN, CHECK, or WAIVED then prereq is met ;; ;; Note: do not convert to remote as it calls remote under the hood -;; -(define (db:get-prereqs-not-met db run-id waitons ref-item-path) +;; Note: mode 'normal means that tests must be COMPLETED and ok (i.e. PASS, WARN, CHECK or WAIVED) +;; mode 'toplevel means that tests must be COMPLETED only +;; +(define (db:get-prereqs-not-met db run-id waitons ref-item-path #!key (mode 'normal)) (if (or (not waitons) (null? waitons)) '() (let* ((unmet-pre-reqs '()) (result '())) @@ -1033,21 +1035,23 @@ (set! ever-seen #t) (cond ;; case 1, non-item (parent test) is ((and (equal? item-path "") ;; this is the parent test is-completed - is-ok) + (or is-ok (eq? mode 'toplevel))) (set! parent-waiton-met #t)) ((and same-itempath is-completed - is-ok) + (or is-ok (eq? mode 'toplevel))) (set! item-waiton-met #t))))) tests) (if (not (or parent-waiton-met item-waiton-met)) - (set! result (cons waitontest-name result))) + (set! result (append (if (null? tests) (list waitontest-name) tests) result))) ;; if the test is not found then clearly the waiton is not met... - (if (not ever-seen)(set! result (cons waitontest-name result))))) + ;; (if (not ever-seen)(set! result (cons waitontest-name result))))) + (if (not ever-seen) + (set! result (append (if (null? tests)(list waitontest-name) tests) result))))) waitons) (delete-duplicates result)))) (define (db:teststep-set-status! db test-id teststep-name state-in status-in item-path comment logfile) (debug:print 4 "test-id: " test-id " teststep-name: " teststep-name) ADDED docs/manual/Makefile Index: docs/manual/Makefile ================================================================== --- /dev/null +++ docs/manual/Makefile @@ -0,0 +1,5 @@ + +megatest_manual.html : megatest_manual.txt getting_started.txt writing_tests.txt reference.txt + asciidoc megatest_manual.txt + dos2unix megatest_manual.html + ADDED docs/manual/getting_started.txt Index: docs/manual/getting_started.txt ================================================================== --- /dev/null +++ docs/manual/getting_started.txt @@ -0,0 +1,81 @@ + +Getting Started +=============== + +[partintro] +.Getting started with Megatest +-- +How to install Megatest and set it up for running your regressions and continuous integration process. +-- + +Installation +------------ + +Dependencies +~~~~~~~~~~~~ + +Chicken scheme and a number of "eggs" are required for building +Megatest. See the script installall.sch in the utils directory of the +distribution for a mostly automated way to install everything needed +for building Megatest on Linux. + +footnote:[An example footnote.] +indexterm:[Example index entry] + + + +And now for something completely different: ((monkeys)), lions and +tigers (Bengal and Siberian) using the alternative syntax index +entries. +(((Big cats,Lions))) +(((Big cats,Tigers,Bengal Tiger))) +(((Big cats,Tigers,Siberian Tiger))) +Note that multi-entry terms generate separate index entries. + +Here are a couple of image examples: an image:images/smallnew.png[] +example inline image followed by an example block image: + +.Tiger block image +image::images/tiger.png[Tiger image] + +Followed by an example table: + +.An example table +[width="60%",options="header"] +|============================================== +| Option | Description +| -a 'USER GROUP' | Add 'USER' to 'GROUP'. +| -R 'GROUP' | Disables access to 'GROUP'. +|============================================== + +.An example example +=============================================== +Lorum ipum... +=============================================== + +[[X1]] +Sub-section with Anchor +~~~~~~~~~~~~~~~~~~~~~~~ +Sub-section at level 2. + +Chapter Sub-section +^^^^^^^^^^^^^^^^^^^ +Sub-section at level 3. + +Chapter Sub-section ++++++++++++++++++++ +Sub-section at level 4. + +This is the maximum sub-section depth supported by the distributed +AsciiDoc configuration. +footnote:[A second example footnote.] + + +The Second Chapter +------------------ +An example link to anchor at start of the <>. +indexterm:[Second example index entry] + +An example link to a bibliography entry <>. + + ADDED docs/manual/megatest_manual.html Index: docs/manual/megatest_manual.html ================================================================== --- /dev/null +++ docs/manual/megatest_manual.html @@ -0,0 +1,1013 @@ + + + + + +The Megatest Users Manual + + + + + +
+
+

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.

+
+

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.

+
+
+
+
+
+

Preface

+
+

This book is organised as three sub-books; getting started, writing tests and reference.

+
+

Why Megatest?

+

The Megatest project was started for two reasons, the first was an +immediate and pressing need for a generalized tool to manage a suite +of regression tests and the second was the fact that I had written or +maintained several such tools at different companies over the years +and it seemed a good thing to have a single open source tool, flexible +enough to meet the needs of any team doing continuous integrating and +or running a complex suite of tests for release qualification.

+
+
+

Megatest Design Philosophy

+

Megatest is intended to provide the minimum needed resources to make +writing a suite of tests and implementing continuous build for +software, design engineering or process control (via owlfs for +example) without being specialized for any specific problem +space. Megatest in of itself does not know what constitutes a PASS or +FAIL of a test. In most cases megatest is best used in conjunction +with logpro or a similar tool to parse, analyze and decide on the test +outcome.

+
+
+

Megatest Architecture

+

All data to specify the tests and configure the system is stored in +plain text files. All system state is stored in an sqlite3 +database. Tests are launched using the launching system available for +the distributed compute platform in use. A template script is provided +which can launch jobs on local and remote Linux hosts. Currently +megatest uses the network filesystem to call home to your master +sqlite3 database.

+
+
+
+

Getting Started

+
+
Getting started with Megatest
+
+

How to install Megatest and set it up for running your regressions and continuous integration process.

+
+
+

Installation

+
+
+

Dependencies

+

Chicken scheme and a number of "eggs" are required for building +Megatest. See the script installall.sch in the utils directory of the +distribution for a mostly automated way to install everything needed +for building Megatest on Linux.

+


[An example footnote.]

+

And now for something completely different: monkeys, lions and +tigers (Bengal and Siberian) using the alternative syntax index +entries. + + + +Note that multi-entry terms generate separate index entries.

+

Here are a couple of image examples: an +images/smallnew.png + +example inline image followed by an example block image:

+
+
+Tiger image +
+
Figure 1. Tiger block image
+
+

Followed by an example table:

+
+ + +++ + + + + + + + + + + + + + + + +
Table 1. An example table
Option Description

-a USER GROUP

Add USER to GROUP.

-R GROUP

Disables access to GROUP.

+
+
+
Example 1. An example example
+
+

Lorum ipum…

+
+
+
+

Sub-section with Anchor

+

Sub-section at level 2.

+
+

Chapter Sub-section

+

Sub-section at level 3.

+
+
Chapter Sub-section
+

Sub-section at level 4.

+

This is the maximum sub-section depth supported by the distributed +AsciiDoc configuration. +
[A second example footnote.]

+
+
+
+
+
+
+

The Second Chapter

+
+

An example link to anchor at start of the first sub-section.

+

An example link to a bibliography entry [taoup].

+
+
+

Reference

+
+

The First Chapter of the Second Part

+
+

Chapters grouped into book parts are at level 1 and can contain +sub-sections.

+
+
+
+

The testconfig File

+
+
+
+
# testconfig
+[requirements]
+
+# A normal waiton waits for the prior tests to be COMPLETED
+# and PASS, CHECK or WAIVED
+waiton test1 test2
+
+# A item based waiton will start items in a test when the
+# same-named item is COMPLETED and PASS, CHECK or WAIVED
+# in the prior test
+#
+mode   normal | toplevel
+
+# With a toplevel test you may wish to generate your list
+# of tests to run dynamically
+#
+# waiton #{shell get-valid-tests-to-run.sh}
+
+
+
+
+

Appendix A: Example Appendix

+
+

One or more optional appendixes go here at section level zero.

+
+

Appendix Sub-section

+
+ + + +
+
Note
+
Preface and appendix subsections start out of sequence at level +2 (level 1 is skipped). This only applies to multi-part book +documents.
+
+
+
+
+
+

Example Bibliography

+
+

The bibliography list is a style of AsciiDoc bulleted list.

+
    +
  • +

    +[taoup] Eric Steven Raymond. The Art of Unix + Programming. Addison-Wesley. ISBN 0-13-142901-9. +

    +
  • +
  • +

    +[walsh-muellner] Norman Walsh & Leonard Muellner. + DocBook - The Definitive Guide. O’Reilly & Associates. 1999. + ISBN 1-56592-580-7. +

    +
  • +
+
+
+
+

Example Glossary

+
+

Glossaries are optional. Glossaries entries are an example of a style +of AsciiDoc labeled lists.

+
+
+A glossary term +
+
+

+ The corresponding (indented) definition. +

+
+
+A second glossary term +
+
+

+ The corresponding (indented) definition. +

+
+
+
+
+
+

Example Colophon

+
+

Text at the end of a book describing facts about its production.

+
+
+
+

Example Index

+
+
+
+
+

+ + + ADDED docs/manual/megatest_manual.txt Index: docs/manual/megatest_manual.txt ================================================================== --- /dev/null +++ docs/manual/megatest_manual.txt @@ -0,0 +1,123 @@ +The Megatest Users Manual +========================= +Matt Welland +v1.0, April 2012 +:doctype: book + + +[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. + +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. + +[preface] +Preface +======= +This book is organised as three sub-books; getting started, writing tests and reference. + +Why Megatest? +~~~~~~~~~~~~~ + +The Megatest project was started for two reasons, the first was an +immediate and pressing need for a generalized tool to manage a suite +of regression tests and the second was the fact that I had written or +maintained several such tools at different companies over the years +and it seemed a good thing to have a single open source tool, flexible +enough to meet the needs of any team doing continuous integrating and +or running a complex suite of tests for release qualification. + +Megatest Design Philosophy +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Megatest is intended to provide the minimum needed resources to make +writing a suite of tests and implementing continuous build for +software, design engineering or process control (via owlfs for +example) without being specialized for any specific problem +space. Megatest in of itself does not know what constitutes a PASS or +FAIL of a test. In most cases megatest is best used in conjunction +with logpro or a similar tool to parse, analyze and decide on the test +outcome. + +Megatest Architecture +~~~~~~~~~~~~~~~~~~~~~ + +All data to specify the tests and configure the system is stored in +plain text files. All system state is stored in an sqlite3 +database. Tests are launched using the launching system available for +the distributed compute platform in use. A template script is provided +which can launch jobs on local and remote Linux hosts. Currently +megatest uses the network filesystem to call home to your master +sqlite3 database. + +include::getting_started.txt[] include::writing_tests.txt[] +include::reference.txt[] + +[appendix] +Example Appendix +================ +One or more optional appendixes go here at section level zero. + +Appendix Sub-section +~~~~~~~~~~~~~~~~~~~ +NOTE: Preface and appendix subsections start out of sequence at level +2 (level 1 is skipped). This only applies to multi-part book +documents. + + + +[bibliography] +Example Bibliography +==================== +The bibliography list is a style of AsciiDoc bulleted list. + +[bibliography] +- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix + Programming'. Addison-Wesley. ISBN 0-13-142901-9. +- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner. + 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999. + ISBN 1-56592-580-7. + + +[glossary] +Example Glossary +================ +Glossaries are optional. Glossaries entries are an example of a style +of AsciiDoc labeled lists. + +[glossary] +A glossary term:: + The corresponding (indented) definition. + +A second glossary term:: + The corresponding (indented) definition. + + +[colophon] +Example Colophon +================ +Text at the end of a book describing facts about its production. + + +[index] +Example Index +============= +//////////////////////////////////////////////////////////////// +The index is normally left completely empty, it's contents are +generated automatically by the DocBook toolchain. +//////////////////////////////////////////////////////////////// ADDED docs/manual/reference.txt Index: docs/manual/reference.txt ================================================================== --- /dev/null +++ docs/manual/reference.txt @@ -0,0 +1,34 @@ + +Reference +========= + +The First Chapter of the Second Part +------------------------------------ +Chapters grouped into book parts are at level 1 and can contain +sub-sections. + +The testconfig File +------------------- + +------------------- +# testconfig +[requirements] + +# A normal waiton waits for the prior tests to be COMPLETED +# and PASS, CHECK or WAIVED +waiton test1 test2 + +# A item based waiton will start items in a test when the +# same-named item is COMPLETED and PASS, CHECK or WAIVED +# in the prior test +# +mode normal | toplevel + +# With a toplevel test you may wish to generate your list +# of tests to run dynamically +# +# waiton #{shell get-valid-tests-to-run.sh} +------------------ + +:numbered!: + ADDED docs/manual/thoughts.fig Index: docs/manual/thoughts.fig ================================================================== --- /dev/null +++ docs/manual/thoughts.fig @@ -0,0 +1,49 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 1800 3000 10800 3000 10800 4800 1800 4800 1800 3000 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 14475 975 15975 975 15975 1500 14475 1500 14475 975 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 15075 2550 14100 3675 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 14175 4275 15150 5475 +4 0 0 50 -1 0 24 0.0000 4 255 990 3150 1800 -runall\001 +4 0 0 50 -1 0 24 0.0000 4 330 4665 2175 5190 (expect:ignore Test: abc FAIL/)\001 +4 0 0 50 -1 0 24 0.0000 4 330 1095 2400 6225 [group]\001 +4 0 0 50 -1 0 24 0.0000 4 330 2415 2625 8085 megatest -runall\001 +4 0 0 50 -1 0 24 0.0000 4 360 1185 5250 8025 $(TAG)\001 +4 0 0 50 -1 0 24 0.0000 4 255 3045 4650 8700 make TARGET=foo\001 +4 0 0 50 -1 0 24 0.0000 4 330 4755 2625 6825 TAG1 envsetup test1 test2 testx\001 +4 0 0 50 -1 0 24 0.0000 4 330 1440 7875 1425 testconfig\001 +4 0 0 50 -1 0 24 0.0000 4 330 2190 7875 1845 [requirements]\001 +4 0 0 50 -1 0 24 0.0000 4 255 2670 3150 2220 -runtests standard\001 +4 0 0 50 -1 0 24 0.0000 4 300 1320 14625 2325 envsetup\001 +4 0 0 50 -1 0 24 0.0000 4 255 705 13650 4125 test1\001 +4 0 0 50 -1 0 24 0.0000 4 255 1410 14550 5850 testsuite2\001 +4 0 0 50 -1 0 24 0.0000 4 255 795 10200 6300 waito\001 +4 0 0 50 -1 0 24 0.0000 4 330 3990 7875 2265 testmode normal | toplevel \001 +4 0 0 50 -1 0 24 0.0000 4 330 2610 7875 2685 waitoncompleted \001 +4 0 0 50 -1 0 24 0.0000 4 360 9255 2175 4350 megatest -list-runs $MT_RUNNAME -target $MT_TARGET\001 +4 0 0 50 -1 0 24 0.0000 4 330 1860 10050 7275 test_toplevel\001 +4 0 0 50 -1 0 24 0.0000 4 330 2190 10050 7695 [requirements]\001 +4 0 0 50 -1 0 24 0.0000 4 330 2580 10050 8115 testmode toplevel\001 +4 0 0 50 -1 0 24 0.0000 4 330 2580 10050 8535 waiton testx testy\001 +4 0 0 50 -1 0 24 0.0000 4 225 810 10050 9375 testx:\001 +4 0 0 50 -1 0 24 0.0000 4 315 1050 10050 9795 [items]\001 +4 0 0 50 -1 0 24 0.0000 4 300 780 10050 11055 testy:\001 +4 0 0 50 -1 0 24 0.0000 4 315 1050 10050 11475 [items]\001 +4 0 0 50 -1 0 24 0.0000 4 330 2190 10800 13170 [requirements]\001 +4 0 0 50 -1 0 24 0.0000 4 300 780 10050 12735 testy:\001 +4 0 0 50 -1 0 24 0.0000 4 330 3330 10800 13590 waitoncompleted testx\001 +4 0 0 50 -1 0 24 0.0000 4 255 2610 10800 14010 waitonitems testx\001 +4 0 0 50 -1 0 24 0.0000 4 255 1605 10050 10215 X A B D E\001 +4 0 0 50 -1 0 24 0.0000 4 255 1245 10050 11895 Y A B C\001 +4 0 0 50 -1 0 24 0.0000 4 330 6660 2100 3450 waiton #{shell get-valid-tests-for-dotproc.sh}\001 ADDED docs/manual/writing_tests.txt Index: docs/manual/writing_tests.txt ================================================================== --- /dev/null +++ docs/manual/writing_tests.txt @@ -0,0 +1,13 @@ + +Writing Tests +============= + +The First Chapter of the Second Part +------------------------------------ +Chapters grouped into book parts are at level 1 and can contain +sub-sections. + + + +:numbered!: + Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -271,41 +271,71 @@ ;; NB// Should expand items here and then insert into the run queue. (debug:print 5 "test-records: " test-records ", keyvallst: " keyvallst " flags: " (hash-table->alist flags)) (let ((sorted-test-names (tests:sort-by-priority-and-waiton test-records)) (item-patts (hash-table-ref/default flags "-itempatt" #f))) (if (not (null? sorted-test-names)) - (let loop (; (numtimes 0) ;; shouldn't need this - (hed (car sorted-test-names)) + (let loop ((hed (car sorted-test-names)) (tal (cdr sorted-test-names))) (let* ((test-record (hash-table-ref test-records hed)) (tconfig (tests:testqueue-get-testconfig test-record)) (waitons (tests:testqueue-get-waitons test-record)) (priority (tests:testqueue-get-priority test-record)) (itemdat (tests:testqueue-get-itemdat test-record)) ;; itemdat can be a string, list or #f (items (tests:testqueue-get-items test-record)) - (item-path (item-list->path itemdat))) + (item-path (item-list->path itemdat)) + (newtal (append tal (list hed))) + (calc-fails (lambda (prereqs-not-met) + (filter (lambda (test) + (debug:print 9 "test: " test) + (and (vector? test) ;; not (string? test)) + (not (member (db:test-get-status test) + '("PASS" "WARN" "CHECK" "WAIVED"))))) + prereqs-not-met)))) (debug:print 6 "itemdat: " itemdat "\n items: " items "\n item-path: " item-path) (cond ((not items) ;; when false the test is ok to be handed off to launch (but not before) - (let ((have-resources (runs:can-run-more-tests db test-record)) ;; look at the test jobgroup and tot jobs running - (prereqs-not-met (db:get-prereqs-not-met db run-id waitons item-path))) + (let* ((have-resources (runs:can-run-more-tests db test-record)) ;; look at the test jobgroup and tot jobs running + (prereqs-not-met (db:get-prereqs-not-met db run-id waitons item-path)) + (fails (calc-fails prereqs-not-met))) + (debug:print 8 "INFO: have-resources: " have-resources " prereqs-not-met: " prereqs-not-met " fails: " fails) ;; Don't know at this time if the test have been launched at some time in the past ;; i.e. is this a re-launch? - (if (and have-resources - (null? prereqs-not-met)) - ;; no loop - drop though and use the loop at the bottom - (if (patt-list-match item-path item-patts) - (run:test db run-id runname keyvallst test-record flags #f) - (debug:print 1 "INFO: Skipping " (tests:testqueue-get-testname test-record) " " item-path " as it doesn't match " item-patts)) - ;; else the run is stuck, temporarily or permanently - (let ((newtal (append tal (list hed)))) - ;; couldn't run, take a breather - (thread-sleep! 0.1) ;; long sleep here - no resources, may as well be patient - (loop (car newtal)(cdr newtal)))))) + (cond + ((and have-resources + (null? prereqs-not-met)) + ;; no loop here, just drop though and use the loop at the bottom + (if (patt-list-match item-path item-patts) + (run:test db run-id runname keyvallst test-record flags #f) + (debug:print 1 "INFO: Skipping " (tests:testqueue-get-testname test-record) " " item-path " as it doesn't match " item-patts)) + ;; else the run is stuck, temporarily or permanently + ;; but should check if it is due to lack of resources vs. prerequisites + ) + ((not have-resources) ;; simply try again after waiting a second + (thread-sleep! 1.0) + (debug:print 1 "INFO: no resources to run new tests, waiting ...") + ;; could have done hed tal here but doing car/cdr of newtal to rotate tests + (loop (car newtal)(cdr newtal))) + (else ;; must be we have unmet prerequisites + (debug:print 4 "FAILS: " fails) + ;; If one or more of the prereqs-not-met are FAIL then we can issue + ;; a message and drop hed from the items to be processed. + (if (null? fails) + (begin + ;; couldn't run, take a breather + (debug:print 4 "INFO: Shouldn't really get here, race condition? Unable to launch more tests at this moment, killing time ...") + (thread-sleep! 0.1) ;; long sleep here - no resources, may as well be patient + ;; we made new tal by sticking hed at the back of the list + (loop (car newtal)(cdr newtal))) + ;; the waiton is FAIL so no point in trying to run hed ever again + (if (not (null? tal)) + (begin + (debug:print 1 "WARN: Dropping test " (db:test-get-test-name hed) "/" (db:test-get-item-path hed) + " from the launch list as it has prerequistes that are FAIL") + (loop (car tal)(cdr tal))))))))) ;; case where an items came in as a list been processed ((and (list? items) ;; thus we know our items are already calculated (not itemdat)) ;; and not yet expanded into the list of things to be done (if (and (>= *verbosity* 1) @@ -334,12 +364,18 @@ (loop (car tal)(cdr tal)))) ;; if items is a proc then need to run items:get-items-from-config, get the list and loop ;; - but only do that if resources exist to kick off the job ((or (procedure? items)(eq? items 'have-procedure)) - (if (and (runs:can-run-more-tests db test-record) - (null? (db:get-prereqs-not-met db run-id waitons item-path))) + (let* ((can-run-more (runs:can-run-more-tests db test-record)) + (prereqs-not-met (db:get-prereqs-not-met db run-id waitons item-path)) + (fails (calc-fails prereqs-not-met))) + (debug:print 8 "INFO: can-run-more: " can-run-more + " prereqs-not-met:\n " (intersperse prereqs-not-met "\n") + " fails:\n " (intersperse fails "\n")) + (cond + ((and can-run-more (null? prereqs-not-met)) (let ((test-name (tests:testqueue-get-testname test-record))) (setenv "MT_TEST_NAME" test-name) ;; (setenv "MT_RUNNAME" runname) (set-megatest-env-vars db run-id) ;; these may be needed by the launching process (let ((items-list (items:get-items-from-config tconfig))) @@ -347,16 +383,22 @@ (begin (tests:testqueue-set-items! test-record items-list) (loop hed tal)) (begin (debug:print 0 "ERROR: The proc from reading the setup did not yield a list - please report this") - (exit 1))))) - (let ((newtal (append tal (list hed)))) - ;; if can't run more tests, lets take a breather - (thread-sleep! 0.1) ;; may as well wait a while for resources to free up - (loop (car newtal)(cdr newtal))))) - + (exit 1)))))) + ((and can-run-more (null? fails)) + (debug:print 4 "INFO: Can't run more right now, killing a little time ...") + (thread-sleep! 3.0) + (loop (car newtal)(cdr newtal))) ;; an issue with prereqs not yet met? + (else + (debug:print 1 "INFO: test " hed " has failed prerequisite(s); " + (string-intersperse (map db:test-get-testname fails) ", ") + ", removing it from to-do list") + (if (not (null? tal)) + (loop (car tal)(cdr tal))))))) + ;; this case should not happen, added to help catch any bugs ((and (list? items) itemdat) (debug:print 0 "ERROR: Should not have a list of items in a test and the itemspath set - please report this") (exit 1)))) @@ -428,11 +470,10 @@ (string->symbol (test:get-state testdat)) 'failed-to-insert)) ((failed-to-insert) (debug:print 0 "ERROR: Failed to insert the record into the db")) ((NOT_STARTED COMPLETED) - (debug:print 6 "Got here, " (test:get-state testdat)) (let ((runflag #f)) (cond ;; -force, run no matter what (force (set! runflag #t)) ;; NOT_STARTED, run no matter what @@ -441,11 +482,11 @@ ((and (or (not rerun) keepgoing) ;; Require to force re-run for COMPLETED or *anything* + PASS,WARN or CHECK (or (member (test:get-status testdat) '("PASS" "WARN" "CHECK")) (member (test:get-state testdat) '("COMPLETED")))) - (debug:print 2 "INFO: running test " test-name "/" item-path " suppressed as it is COMPLETED and " (test:get-state testdat)) + (debug:print 2 "INFO: running test " test-name "/" item-path " suppressed as it is " (test:get-state testdat) " and " (test:get-status testdat)) (set! runflag #f)) ;; -rerun and status is one of the specifed, run it ((and rerun (let* ((rerunlst (string-split rerun ",")) (must-rerun (member (test:get-status testdat) rerunlst))) Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -5,49 +5,50 @@ PATH := $(BINPATH):$(PATH) RUNNAME := $(shell date +w%V.%u.%H.%M) IPADDR := "-" # Set SERVER to "-server -" SERVER := +DEBUG := 1 -runall : test1 test2 +all : test1 test 2 test3 test1 : cleanprep + mkdir -p simplelinks simpleruns + cd simplerun;echo '(load "../tests.scm")' | $(MEGATEST) -repl -debug $(DEBUG) + +test2 : fullprep cd fullrun;$(MEGATEST) -runtests ez_pass -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_a $(SERVER) -test2 : cleanprep +test3 : fullprep cd fullrun;$(MEGATEST) -runtests runfirst -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_b $(SERVER) -debug 10 -test3 : cleanprep +test4 : fullprep cd fullrun;$(MEGATEST) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_b -m "This is a comment specific to a run" -v $(SERVER) -test4 : cleanprep +test5 : fullprep cd fullrun;$(MEGATEST) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_aa -v $(SERVER) 2&>1 aa.log & cd fullrun;$(MEGATEST) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_ab -v $(SERVER) 2&>1 ab.log & cd fullrun;$(MEGATEST) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_ac -v $(SERVER) 2&>1 ac.log & cd fullrun;$(MEGATEST) -runall -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_ad -v $(SERVER) 2&>1 ad.log & cd fullrun;$(MEGATEST) -runtests runfirst -itempatt %/1 -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -v cd fullrun;$(MEGATEST) -runtests runfirst -itempatt %blahha% -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_itempatt -debug 10 -cleanprep : ../*.scm Makefile *.config +cleanprep : ../*.scm Makefile */*.config sqlite3 megatest.db "delete from metadat where var='SERVER';" mkdir -p /tmp/mt_runs /tmp/mt_links cd ..;make install - cd fullrun;$(MEGATEST) -remove-runs :runname $(RUNNAME)% -target %/%/% -testpatt % -itempatt % - cd fullrun;$(BINPATH)/dboard -rows 15 & touch cleanprep -test : - csi -b -I .. ../megatest.scm -- -runall -target ubuntu/afs/tmp :runname blah - cd ../;make test - make runall - -dashboard : - cd ../;make install - cd fullrun;$(BINPATH)/dboard & +fullprep : cleanprep + cd fullrun;$(MEGATEST) -remove-runs :runname $(RUNNAME)% -target %/%/% -testpatt % -itempatt % + cd fullrun;$(BINPATH)/dboard -rows 15 & + +dashboard : cleanprep + cd fullrun && $(BINPATH)/dboard & remove : - (cd ../;make);cd fullrun;$(MEGATEST) -remove-runs :runname $(RUN) -testpatt % -itempatt % :sysname % :fsname % :datapath % + cd fullrun;$(MEGATEST) -remove-runs :runname $(RUN) -testpatt % -itempatt % :sysname % :fsname % :datapath % clean : rm cleanprep runforever : Index: tests/simplerun/megatest.config ================================================================== --- tests/simplerun/megatest.config +++ tests/simplerun/megatest.config @@ -6,10 +6,14 @@ # Adjust max_concurrent_jobs to limit how much you load your machines max_concurrent_jobs 50 # This is your link path, you can move it but it is generally better to keep it stable linktree ../simplelinks + +# 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 nbfind ADDED tests/simplerun/test.config Index: tests/simplerun/test.config ================================================================== --- /dev/null +++ tests/simplerun/test.config @@ -0,0 +1,31 @@ +[section1] +1 ./blah + +[section2] + +# A comment + +[disks] +1 ./ + +[validvalues] +state start end aborted +status pass fail n/a + +[include a file that doesn't exist] + + +blah nada + +# now inlcude a file tha tdoes exist +[include megatest.config] + +[metadata] +description This is a multiline + description. The leading whitespace is discarded + irrespective of amount of indenting. + This line is indented more. + + +author matt +lastreview never DELETED tests/test.config Index: tests/test.config ================================================================== --- tests/test.config +++ /dev/null @@ -1,31 +0,0 @@ -[section1] -1 ./blah - -[section2] - -# A comment - -[disks] -1 ./ - -[validvalues] -state start end aborted -status pass fail n/a - -[include a file that doesn't exist] - - -blah nada - -# now inlcude a file tha tdoes exist -[include megatest.config] - -[metadata] -description This is a multiline - description. The leading whitespace is discarded - irrespective of amount of indenting. - This line is indented more. - - -author matt -lastreview never Index: tests/tests.scm ================================================================== --- tests/tests.scm +++ tests/tests.scm @@ -1,19 +1,6 @@ -(use test) -;; (require-library args) - -(include "../megatest.scm") -(include "../common.scm") -(include "../keys.scm") -(include "../db.scm") -(include "../configf.scm") -(include "../process.scm") -(include "../launch.scm") -(include "../items.scm") -(include "../runs.scm") -(include "../runconfig.scm") -(include "../megatest-version.scm") +(require-extension test) (define test-work-dir (current-directory)) (define conffile #f) (test "Read a config" #t (hash-table? (read-config "test.config" #f #f))) @@ -61,28 +48,34 @@ (test "write env files" "nada.csh" (begin (save-environment-as-files "nada") (and (file-exists? "nada.sh") (file-exists? "nada.csh")))) -(test "get all legal tests" (list "runfirst" "runwithfirst" "singletest" "singletest2" "sqlitespeed") (sort (get-all-legal-tests) string<=?)) +(test "get all legal tests" (list "test1" "test2") (sort (get-all-legal-tests) string<=?)) (test "register-test, test info" "NOT_STARTED" (begin - (register-test *db* 1 "nada" "" '("tag1" "tag2" "tag3")) - (test:get-state (db:get-test-info *db* 1 "nada" "")))) + (tests:register-test *db* 1 "nada" "") + (vector-ref (db:get-test-info *db* 1 "nada" "") 3))) -(test "get-keys" "sysname" (key:get-fieldname (car (sort (db-get-keys *db*)(lambda (a b)(string>=? (vector-ref a 0)(vector-ref b 0))))))) +(test "get-keys" "SYSTEM" (vector-ref (car (db:get-keys *db*)) 0));; (key:get-fieldname (car (sort (db-get-keys *db*)(lambda (a b)(string>=? (vector-ref a 0)(vector-ref b 0))))))) (define remargs (args:get-args '("bar" "foo" ":runname" "bob" ":sysname" "ubuntu" ":fsname" "nfs" ":datapath" "blah/foo" "nada") (list ":runname" ":state" ":status") (list "-h") args:arg-hash 0)) -(test "register-run" #t (number? (register-run *db* (db-get-keys *db*)))) -(define keys (db-get-keys *db*)) +(test "register-run" #t (number? (runs:register-run *db* + (db:get-keys *db*) + '(("SYSTEM" "key1")("OS" "key2")) + "myrun" + "new" + "n/a" + "bob"))) +(define keys (db:get-keys *db*)) ;;(test "update-test-info" #t (test-update-meta-info *db* 1 "nada" (setenv "BLAHFOO" "1234") (unsetenv "NADAFOO") (test "env temp overrides" "xyz" (let ((prevvals (alist->env-vars '(("BLAHFOO" 4321)("NADAFOO" xyz)))) @@ -110,11 +103,14 @@ ;; force keepgoing ; (hash-table-set! args:arg-hash "-keepgoing" #t) (hash-table-set! args:arg-hash "-itempatt" "%") (hash-table-set! args:arg-hash "-testpatt" "%") (test "Setup for a run" #t (begin (setup-for-run) #t)) -(test "Remove the rollup run" #t (begin (remove-runs) #t)) + + +;; (test "Remove the rollup run" #t (begin (remove-runs) #t)) + (test "Run a test" #t (general-run-call "-runtests" "run a test" (lambda (db keys keynames keyvallst) (let ((test-names '("runfirst"))) @@ -137,5 +133,8 @@ (test "Remove the rollup run" #t (begin (remove-runs) #t)) (test "Rollup the run(s)" #t (begin (runs:rollup-run db keys) #t)) + +;; ADD ME!!!! (db:get-prereqs-not-met *db* 1 '("runfirst") "" mode: 'normal) +;; ADD ME!!!! (rdb:get-tests-for-run *db* 1 "runfirst" #f '() '())