Overview
Comment: | Updated ezsteps propagation and documentation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.65 |
Files: | files | file ages | folders |
SHA1: |
b8cc18503afa791f3f53f76eba0fdf21 |
User & Date: | matt on 2020-10-27 22:43:47 |
Other Links: | branch diff | manifest | tags |
Context
2020-10-27
| ||
23:44 | Merged in last of testdat changes from testdat2 via meld check-in: 21849054ca user: matt tags: v1.65 | |
22:43 | Updated ezsteps propagation and documentation check-in: b8cc18503a user: matt tags: v1.65 | |
2020-10-26
| ||
22:12 | Added auto propagation of env. vars in steps check-in: 21d4a4c30b user: mrwellan tags: v1.65 | |
Changes
Modified docs/manual/megatest_manual.html from [70c989fffc] to [3a05c4c8b7].
1 2 3 4 | <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="generator" content="AsciiDoc 9.0.0rc1"> <title>The Megatest Users Manual</title> <style type="text/css"> /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ /* Default font. */ body { font-family: Georgia,serif; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | ul, ol, li > p { margin-top: 0; } ul > li { color: #aaa; } ul > li > * { color: black; } | | > > > > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | ul, ol, li > p { margin-top: 0; } ul > li { color: #aaa; } ul > li > * { color: black; } .monospaced, code, pre { font-family: "Courier New", Courier, monospace; font-size: inherit; color: navy; padding: 0; margin: 0; } pre { white-space: pre-wrap; } #author { color: #527bbd; font-weight: bold; font-size: 1.1em; } #email { |
︙ | ︙ | |||
214 215 216 217 218 219 220 | div.exampleblock > div.content { border-left: 3px solid #dddddd; padding-left: 0.5em; } div.imageblock div.content { padding-left: 0; } | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | div.exampleblock > div.content { border-left: 3px solid #dddddd; padding-left: 0.5em; } div.imageblock div.content { padding-left: 0; } span.image img { border-style: none; vertical-align: text-bottom; } a.image:visited { color: white; } dl { margin-top: 0.8em; margin-bottom: 0.8em; } dt { |
︙ | ︙ | |||
410 411 412 413 414 415 416 | /* * xhtml11 specific * * */ | < < < < < < | < < < < < < | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | /* * xhtml11 specific * * */ div.tableblock { margin-top: 1.0em; margin-bottom: 1.5em; } div.tableblock > table { border: 3px solid #527bbd; } thead, p.table.header { font-weight: bold; color: #527bbd; } p.table { margin-top: 0; } /* Because the table frame attribute is overridden by CSS in most browsers. */ div.tableblock > table[frame="void"] { border-style: none; } div.tableblock > table[frame="hsides"] { border-left-style: none; border-right-style: none; } div.tableblock > table[frame="vsides"] { border-top-style: none; border-bottom-style: none; } /* * html5 specific * * */ table.tableblock { margin-top: 1.0em; margin-bottom: 1.5em; } thead, p.tableblock.header { font-weight: bold; color: #527bbd; |
︙ | ︙ | |||
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | body.manpage div.sectionbody { margin-left: 3em; } @media print { body.manpage div#toc { display: none; } } @media screen { body { max-width: 50em; /* approximately 80 characters wide */ margin-left: 16em; } #toc { | > > | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | body.manpage div.sectionbody { margin-left: 3em; } @media print { body.manpage div#toc { display: none; } } @media screen { body { max-width: 50em; /* approximately 80 characters wide */ margin-left: 16em; } #toc { |
︙ | ︙ | |||
2338 2339 2340 2341 2342 2343 2344 | </div></div> </div> <div class="sect2"> <h3 id="_trim_trailing_spaces">Trim trailing spaces</h3> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | </div></div> </div> <div class="sect2"> <h3 id="_trim_trailing_spaces">Trim trailing spaces</h3> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">As of Megatest version v1.6548 trim-trailing-spaces defaults to yes.</td> </tr></table> </div> <div class="listingblock"> <div class="content monospaced"> <pre>[configf:settings trim-trailing-spaces no] |
︙ | ︙ | |||
2655 2656 2657 2658 2659 2660 2661 | <pre># A normal waiton waits for the prior tests to be COMPLETED # and PASS, CHECK or WAIVED waiton test1 test2</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 | <pre># A normal waiton waits for the prior tests to be COMPLETED # and PASS, CHECK or WAIVED waiton test1 test2</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">Dynamic waiton lists must be capable of being calculated at the beginning of a run. This is because Megatest walks the tree of waitons to create the list of tests to execute.</td> </tr></table> </div> <div class="listingblock"> |
︙ | ︙ | |||
3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 | testname1/itempath A comment about why it was waived testname2 A comment for a non-itemized test</pre> </div></div> </div> </div> <div class="sect2"> <h3 id="_ezsteps">Ezsteps</h3> <div class="listingblock"> <div class="title">Example ezsteps with logpro rules</div> <div class="content monospaced"> <pre>[ezsteps] lookittmp ls /tmp [logpro] lookittmp ;; Note: config file format supports multi-line entries where leading whitespace is removed from each line ;; a blank line indicates the end of the block of text (expect:required in "LogFileBody" > 0 "A file name that should never exist!" #/This is a awfully stupid file name that should never be found in the temp dir/)</pre> </div></div> | > > > > > > > > > < < < < < < | | > > > > > > > > > > > > | > > > > > > > > > > > > > > > | 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 | testname1/itempath A comment about why it was waived testname2 A comment for a non-itemized test</pre> </div></div> </div> </div> <div class="sect2"> <h3 id="_ezsteps">Ezsteps</h3> <div class="paragraph"><p>Ezsteps is the recommended way to implement tests and automation in Megatest.</p></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">Each ezstep must be a single line. Use the [scripts] mechanism to create multiline scripts (see example below).</td> </tr></table> </div> <div class="listingblock"> <div class="title">Example ezsteps with logpro rules</div> <div class="content monospaced"> <pre>[ezsteps] lookittmp ls /tmp [logpro] lookittmp ;; Note: config file format supports multi-line entries where leading whitespace is removed from each line ;; a blank line indicates the end of the block of text (expect:required in "LogFileBody" > 0 "A file name that should never exist!" #/This is a awfully stupid file name that should never be found in the temp dir/)</pre> </div></div> <div class="sect3"> <h4 id="_automatic_environment_propagation_with_ezsteps">Automatic environment propagation with Ezsteps</h4> <div class="paragraph"><p>Turn on ezpropvars or simply give your step name an extension of .sh or .csh. The environment variables will be propagated.</p></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">aliases and variables with strange whitespace or characters will not propagate correctly. Put in a ticket on the <a href="http://www.kiatoa.com/fossils/megatest">http://www.kiatoa.com/fossils/megatest</a> site if you need support for a specific strange character combination.</td> </tr></table> </div> <div class="listingblock"> <div class="title">Turn on auto propagate for bash</div> <div class="content monospaced"> <pre>[setup] ezpropvars sh /bin/bash</pre> </div></div> <div class="listingblock"> <div class="title">Turn on auto propagate for csh</div> <div class="content monospaced"> <pre>[setup] ezpropvars csh /bin/csh</pre> </div></div> <div class="listingblock"> <div class="title">Example of auto propagation using extensions</div> <div class="content monospaced"> <pre>[ezsteps] step1.sh export SOMEVAR=$(ps -def | wc -l);ls /tmp # The next step will get the value of $SOMEVAR from step1.sh step2.sh echo $SOMEVAR</pre> </div></div> <div class="listingblock"> <div class="title">Example of multi-line script</div> <div class="content monospaced"> <pre>[scripts] tarresults tar cfvz $DEST/srcdir1.tar.gz srcdir1 tar cfvz $DEST/srcdir2.tar.gz srcdir2 [setup] ezpropvars sh [ezsteps] step1 DEST=/tmp/targz;source tarresults</pre> </div></div> <div class="paragraph"><p>The above example will result in files; tarresults and ez_step1 being created in the test dir.</p></div> </div> </div> <div class="sect2"> <h3 id="_scripts">Scripts</h3> <div class="listingblock"> <div class="title">Specifying scripts inline (best used for only simple scripts)</div> <div class="content monospaced"> |
︙ | ︙ | |||
3180 3181 3182 3183 3184 3185 3186 | <div class="content monospaced"> <pre>[triggers] COMPLETED/ xterm -e bash -s --</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> | | | 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 | <div class="content monospaced"> <pre>[triggers] COMPLETED/ xterm -e bash -s --</pre> </div></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <img src="/usr/images/icons/note.png" alt="Note"> </td> <td class="content">There is a trailing space after the double-dash</td> </tr></table> </div> <div class="paragraph"><p>There are a number of environment variables available to the trigger script but since triggers can be called in various contexts not all variables are available at all times. The trigger script should check for the variable and |
︙ | ︙ | |||
3517 3518 3519 3520 3521 3522 3523 | </div> </div> </div> <div id="footnotes"><hr></div> <div id="footer"> <div id="footer-text"> Version 1.5<br> | | > | 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 | </div> </div> </div> <div id="footnotes"><hr></div> <div id="footer"> <div id="footer-text"> Version 1.5<br> Last updated 2020-10-11 21:26:10 MST </div> </div> </body> </html> |
Modified docs/manual/reference.txt from [a5ee87815b] to [c3b62c7e63].
︙ | ︙ | |||
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | testname1/itempath A comment about why it was waived testname2 A comment for a non-itemized test --------------------------- Ezsteps ~~~~~~~ .Example ezsteps with logpro rules ----------------- [ezsteps] lookittmp ls /tmp [logpro] lookittmp ;; Note: config file format supports multi-line entries where leading whitespace is removed from each line ;; a blank line indicates the end of the block of text (expect:required in "LogFileBody" > 0 "A file name that should never exist!" #/This is a awfully stupid file name that should never be found in the temp dir/) ----------------- | > > > > < < < < < < < | > > > > > > > > > > > > | > > > > > > > > > > > > > > > > | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | testname1/itempath A comment about why it was waived testname2 A comment for a non-itemized test --------------------------- Ezsteps ~~~~~~~ Ezsteps is the recommended way to implement tests and automation in Megatest. NOTE: Each ezstep must be a single line. Use the [scripts] mechanism to create multiline scripts (see example below). .Example ezsteps with logpro rules ----------------- [ezsteps] lookittmp ls /tmp [logpro] lookittmp ;; Note: config file format supports multi-line entries where leading whitespace is removed from each line ;; a blank line indicates the end of the block of text (expect:required in "LogFileBody" > 0 "A file name that should never exist!" #/This is a awfully stupid file name that should never be found in the temp dir/) ----------------- Automatic environment propagation with Ezsteps ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Turn on ezpropvars or simply give your step name an extension of .sh or .csh. The environment variables will be propagated. NOTE: aliases and variables with strange whitespace or characters will not propagate correctly. Put in a ticket on the http://www.kiatoa.com/fossils/megatest site if you need support for a specific strange character combination. .Turn on auto propagate for bash --------------------------- [setup] ezpropvars sh /bin/bash --------------------------- .Turn on auto propagate for csh --------------------------- [setup] ezpropvars csh /bin/csh --------------------------- .Example of auto propagation using extensions --------------------------- [ezsteps] step1.sh export SOMEVAR=$(ps -def | wc -l);ls /tmp # The next step will get the value of $SOMEVAR from step1.sh step2.sh echo $SOMEVAR --------------------------- .Example of multi-line script --------------------------- [scripts] tarresults tar cfvz $DEST/srcdir1.tar.gz srcdir1 tar cfvz $DEST/srcdir2.tar.gz srcdir2 [setup] ezpropvars sh [ezsteps] step1 DEST=/tmp/targz;source tarresults --------------------------- The above example will result in files; tarresults and ez_step1 being created in the test dir. Scripts ~~~~~~~ .Specifying scripts inline (best used for only simple scripts) ---------------------------- [scripts] |
︙ | ︙ |
Modified docs/manual/server.png from [ae7d7ee58e] to [6a7e2083a5].
cannot compute difference between binary files
Modified ezsteps.scm from [d79baadfc3] to [08e4c9f80b].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 | ;; (declare (uses sdb)) ;; (declare (uses filedb)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (define (ezsteps:step-name->mode stepname) (match (string-search "\\.([^\\.]+)$" stepname) ((_ ext) (string->symbol ext)) (else #f))) | > | | | | | | > > > | > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > | | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | ;; (declare (uses sdb)) ;; (declare (uses filedb)) (include "common_records.scm") (include "key_records.scm") (include "db_records.scm") (include "run_records.scm") (define (ezsteps:step-name->mode stepname) (match (string-search "\\.([^\\.]+)$" stepname) ((_ ext) (string->symbol ext)) (else #f))) (define (ezsteps:create-step-script envdbf stepname prevstepname mode cmd shellexe) (let* (#;(shebang (case mode ((sh) "/bin/sh") ((csh) "/bin/csh") (else "/bin/bash"))) (sourcef (conc ".ezsteps/vars_" prevstepname "." mode)) (scriptn (conc "ez_" stepname))) ;; remember the name already has an extension .sh, .csh etc. (with-output-to-file scriptn (lambda () ;; the shebang line (print "#!" shellexe) ;; first setup the source of the previous changes (if (file-exists? sourcef) (print "source " sourcef)) ;; save the env at start (print "megatest -envcap "stepname"_start "envdbf) ;; run the command (print cmd) (if (eq? mode 'csh) (print "set ecode=$?") (print "ecode=$?")) ;; save the env at end (print "megatest -envcap "stepname"_end "envdbf) ;; write the delta (print "megatest -envdelta "stepname"_start-"stepname"_end -dumpmode bash -o .ezsteps/vars_"stepname".sh "envdbf) (print "megatest -envdelta "stepname"_start-"stepname"_end -dumpmode csh -o .ezsteps/vars_"stepname".csh "envdbf) (print "exit $ecode"))) (system (conc "chmod a+x " scriptn)))) (define (ezsteps:get-ezpropvars res) ;; testconfig) ;; (let* ((res (configf:lookup testconfig "setup" "ezpropvars"))) (if (string? res) (let* ((dat (string-split res))) (match dat ((s shellexe) (let ((shl (string->symbol s))) `(,shl . ,shellexe))) ((s) (let* ((shl (string->symbol s)) (shellexe (if (eq? shl 'csh) "/bin/csh" "/bin/bash"))) `(,shl . ,shellexe))) (else #f))) #f)) ;; NOTE: returns logpro-used? ;; (define (launch:runstep ezstep run-id test-id exit-info m tal testconfig all-steps-dat prevstepname envdbf) (let* ((stepname (car ezstep)) ;; do stuff to run the step (stepmode-n (ezsteps:step-name->mode stepname)) (stepinfo (cadr ezstep)) (shellmode (ezsteps:get-ezpropvars (configf:lookup testconfig "setup" "ezpropvars"))) ;; returns '(csh|sh . "/path/to/shell") (stepmode (if stepmode-n ;; the .sh or .csh always wins stepmode-n (if shellmode (car shellmode) #f))) (shellexe (if stepmode-n (case stepmode ((csh) "/bin/csh") (else "/bin/bash")) (if shellmode (cdr shellmode) "/bin/bash"))) ;; (let ((info (cadr ezstep))) ;; (if (proc? info) "" info))) ;; (stepproc (let ((info (cadr ezstep))) ;; (if (proc? info) info #f))) (stepparts (string-match (regexp "^(\\{([^\\}\\{]*)\\}\\s*|)(.*)$") stepinfo)) (stepparams (if (and (list? stepparts) (> (length stepparts) 1)) (list-ref stepparts 2) #f)) ;; for future use, {VAR=1,2,3}, run step for each (paramparts (if (string? stepparams) (map (lambda (x)(string-split x "=")) (string-split-fields "[^;]*=[^;]*" stepparams)) |
︙ | ︙ | |||
109 110 111 112 113 114 115 | (set! logpro-used #t))) ;; NB// can safely assume we are in test-area directory (debug:print 4 *default-log-port* "ezsteps:\n stepname: " stepname " stepinfo: " stepinfo " stepparts: " stepparts " stepparams: " stepparams " stepcmd: " stepcmd) | | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | (set! logpro-used #t))) ;; NB// can safely assume we are in test-area directory (debug:print 4 *default-log-port* "ezsteps:\n stepname: " stepname " stepinfo: " stepinfo " stepparts: " stepparts " stepparams: " stepparams " stepcmd: " stepcmd) (if stepmode (ezsteps:create-step-script envdbf stepname prevstepname stepmode stepcmd shellexe)) ;; ;; first source the previous environment ;; (let ((prev-env (conc ".ezsteps/" prevstep (if (string-search (regexp "csh") ;; (get-environment-variable "SHELL")) ".csh" ".sh")))) ;; (if (and prevstep (common:file-exists? prev-env)) ;; (set! script (conc script "source " prev-env)))) ;; call the command using mt_ezstep ;; (set! script (conc "mt_ezstep " stepname " " (if prevstep prevstep "x") " " stepcmd)) (debug:print 4 *default-log-port* "script: " script) (rmt:teststep-set-status! run-id test-id stepname "start" "-" #f #f) ;; now launch the actual process (call-with-environment-variables (list (cons "PATH" (conc (get-environment-variable "PATH") ":."))) (lambda () ;; (process-run "/bin/bash" "-c" "exec ls -l /tmp/foobar > /tmp/delme-more.log 2>&1") (let* ((cmd (conc (if stepmode (conc "ez_" stepname) stepcmd) " > " stepname ".log 2>&1")) ;; >outfile 2>&1 (pid #f)) (let ((proc (lambda () (set! pid (process-run "/bin/bash" (list "-c" cmd)))))) (if subrun (begin |
︙ | ︙ |
Modified launch.scm from [740cbb909d] to [0de0e6aa2e].
︙ | ︙ | |||
1546 1547 1548 1549 1550 1551 1552 | (hash-table-ref/default *configdat* "env-override" '()))) (miscprevvals (alist->env-vars ;; consolidate this code with the code in megatest.scm for "-execute" (append (list (list "MT_TEST_RUN_DIR" work-area) (list "MT_TEST_NAME" test-name) (list "MT_ITEM_INFO" (conc itemdat)) (list "MT_RUNNAME" runname) (list "MT_TARGET" mt_target) | | < | 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 | (hash-table-ref/default *configdat* "env-override" '()))) (miscprevvals (alist->env-vars ;; consolidate this code with the code in megatest.scm for "-execute" (append (list (list "MT_TEST_RUN_DIR" work-area) (list "MT_TEST_NAME" test-name) (list "MT_ITEM_INFO" (conc itemdat)) (list "MT_RUNNAME" runname) (list "MT_TARGET" mt_target) (list "MT_ITEMPATH" item-path)) itemdat))) (testprevvals (alist->env-vars (hash-table-ref/default tconfig "pre-launch-env-overrides" '()))) ;; Launchwait defaults to true, must override it to turn off wait (launchwait (if (equal? (configf:lookup *configdat* "setup" "launchwait") "no") #f #t)) (launch-results-prev (apply (if launchwait ;; BB: TODO: refactor this to examine return code of launcher, if nonzero, set state to launch failed. process:cmd-run-with-stderr-and-exitcode->list |
︙ | ︙ |