Overview
Comment: | first pass attempt to do a better job on lazy loading of config files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.60 |
Files: | files | file ages | folders |
SHA1: |
01d8fffe0f9b68428c926b4f1fa32068 |
User & Date: | mrwellan on 2014-10-19 19:59:05 |
Other Links: | branch diff | manifest | tags |
Context
2014-10-19
| ||
21:53 | Better control over processing #{} vs. [] in config files check-in: a492699b81 user: matt tags: v1.60 | |
19:59 | first pass attempt to do a better job on lazy loading of config files check-in: 01d8fffe0f user: mrwellan tags: v1.60 | |
2014-10-17
| ||
00:19 | Changed default server run time to 60 seconds. Removed wait on RUNNING for servers - caused more hassle than benefit check-in: 9818a847b5 user: matt tags: v1.60 | |
Changes
Modified configf.scm from [81365b22b7] to [fd9e5911cc].
︙ | ︙ | |||
59 60 61 62 63 64 65 | (define configf:key-no-val (regexp "^(\\S+)(\\s*)$")) (define configf:comment-rx (regexp "^\\s*#.*")) (define configf:cont-ln-rx (regexp "^(\\s+)(\\S+.*)$")) ;; read a line and process any #{ ... } constructs (define configf:var-expand-regex (regexp "^(.*)#\\{(scheme|system|shell|getenv|get|runconfigs-get|rget)\\s+([^\\}\\{]*)\\}(.*)")) | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | (define configf:key-no-val (regexp "^(\\S+)(\\s*)$")) (define configf:comment-rx (regexp "^\\s*#.*")) (define configf:cont-ln-rx (regexp "^(\\s+)(\\S+.*)$")) ;; read a line and process any #{ ... } constructs (define configf:var-expand-regex (regexp "^(.*)#\\{(scheme|system|shell|getenv|get|runconfigs-get|rget)\\s+([^\\}\\{]*)\\}(.*)")) (define (configf:process-line l ht allow-system) (let loop ((res l)) (if (string? res) (let ((matchdat (string-search configf:var-expand-regex res))) (if matchdat (let* ((prestr (list-ref matchdat 1)) (cmdtype (list-ref matchdat 2)) ;; eval, system, shell, getenv (cmd (list-ref matchdat 3)) |
︙ | ︙ | |||
83 84 85 86 87 88 89 | (sect (car parts)) (var (cadr parts))) (conc "(lambda (ht)(config-lookup ht \"" sect "\" \"" var "\"))"))) ((runconfigs-get) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))")) ((rget) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))")) (else "(lambda (ht)(print \"ERROR\") \"ERROR\")")))) ;; (print "fullcmd=" fullcmd) | > > | | | > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | (sect (car parts)) (var (cadr parts))) (conc "(lambda (ht)(config-lookup ht \"" sect "\" \"" var "\"))"))) ((runconfigs-get) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))")) ((rget) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))")) (else "(lambda (ht)(print \"ERROR\") \"ERROR\")")))) ;; (print "fullcmd=" fullcmd) (if (or allow-system (not (member cmdtype '("system" "shell")))) (with-input-from-string fullcmd (lambda () (set! result ((eval (read)) ht)))) (set! result cmd)) (loop (conc prestr result poststr))) res)) res))) ;; Run a shell command and return the output as a string (define (shell cmd) (let* ((output (cmd-run->list cmd)) |
︙ | ︙ | |||
115 116 117 118 119 120 121 | (define (runconfigs-get config var) (let ((targ (or (args:get-arg "-reqtarg")(args:get-arg "-target")(getenv "MT_TARGET")))) (if targ (or (configf:lookup config targ var) (configf:lookup config "default" var)) (configf:lookup config "default" var)))) | > > | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | (define (runconfigs-get config var) (let ((targ (or (args:get-arg "-reqtarg")(args:get-arg "-target")(getenv "MT_TARGET")))) (if targ (or (configf:lookup config targ var) (configf:lookup config "default" var)) (configf:lookup config "default" var)))) ;; this was inline but I'm pretty sure that is a hold over from when it was *very* simple ... ;; (define (configf:read-line p ht allow-processing) (let loop ((inl (read-line p))) (let ((cont-line (and (string? inl) (not (string-null? inl)) (equal? "\\" (string-take-right inl 1))))) (if cont-line ;; last character is \ (let ((nextl (read-line p))) (if (not (eof-object? nextl)) (loop (string-append (if cont-line (string-take inl (- (string-length inl) 1)) inl) nextl)))) (if (and allow-processing (not (eq? allow-processing 'return-string))) (configf:process-line inl ht allow-processing) inl))))) ;; read a config file, returns hash table of alists ;; read a config file, returns hash table of alists ;; adds to ht if given (must be #f otherwise) ;; envion-patt is a regex spec that identifies sections that will be eval'd |
︙ | ︙ |
Modified docs/manual/megatest_manual.html from [20d78e9a28] to [ec93b0a8a8].
︙ | ︙ | |||
955 956 957 958 959 960 961 962 963 964 965 966 967 968 | <h1 id="_how_to_do_things">How To Do Things</h1> <div class="sect1"> <h2 id="_tricks">Tricks</h2> <div class="sectionbody"> <div class="paragraph"><p>This section is a compendium of a various useful tricks for debugging, configuring and generally getting the most out of Megatest.</p></div> </div> </div> <div class="sect1"> <h2 id="_debugging_tricks">Debugging Tricks</h2> <div class="sectionbody"> <div class="sect2"> <h3 id="_examining_the_environment">Examining The Environment</h3> <div class="sect3"> | > > > > > > > > > > > > > > > > > > > | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | <h1 id="_how_to_do_things">How To Do Things</h1> <div class="sect1"> <h2 id="_tricks">Tricks</h2> <div class="sectionbody"> <div class="paragraph"><p>This section is a compendium of a various useful tricks for debugging, configuring and generally getting the most out of Megatest.</p></div> </div> </div> <div class="sect1"> <h2 id="_limiting_your_running_jobs">Limiting your running jobs</h2> <div class="sectionbody"> <div class="paragraph"><p>The following example will limit a test in the jobgroup "group1" to no more than 10 tests simultaneously.</p></div> <div class="paragraph"><p>In your testconfig:</p></div> <div class="listingblock"> <div class="content"> <pre><tt>[test_meta] jobgroup group1</tt></pre> </div></div> <div class="paragraph"><p>In your megatest.config:</p></div> <div class="listingblock"> <div class="content"> <pre><tt>[jobgroups] group1 10 custdes 4</tt></pre> </div></div> </div> </div> <div class="sect1"> <h2 id="_debugging_tricks">Debugging Tricks</h2> <div class="sectionbody"> <div class="sect2"> <h3 id="_examining_the_environment">Examining The Environment</h3> <div class="sect3"> |
︙ | ︙ | |||
983 984 985 986 987 988 989 990 991 992 | user is responsible for setting STATE and STATUS</p></div> <div class="listingblock"> <div class="content"> <pre><tt>runscript main.csh</tt></pre> </div></div> </div> </div> </div> </div> <div class="sect1"> | > > > > > > > > > > | | | | | | < < < < < < < < < < < < < < < | < < < < < < < | < < | > | < | > > > > > > | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | user is responsible for setting STATE and STATUS</p></div> <div class="listingblock"> <div class="content"> <pre><tt>runscript main.csh</tt></pre> </div></div> </div> </div> <div class="sect2"> <h3 id="_debugging_server_problems">Debugging Server Problems</h3> <div class="listingblock"> <div class="content"> <pre><tt>sudo lsof -i sudo netstat -lptu sudo netstat -tulpn</tt></pre> </div></div> </div> </div> </div> <h1 id="_reference">Reference</h1> <div class="sect1"> <h2 id="_the_first_chapter_of_the_second_part_2">The First Chapter of the Second Part</h2> <div class="sectionbody"> <div class="paragraph"><p>Chapters grouped into book parts are at level 1 and can contain sub-sections.</p></div> </div> </div> <div class="sect1"> <h2 id="_the_testconfig_file">The testconfig File</h2> <div class="sectionbody"> <div class="sect2"> <h3 id="_setup_section">Setup section</h3> <div class="sect3"> <h4 id="_header">Header</h4> <div class="listingblock"> <div class="content"> <pre><tt>[setup]</tt></pre> </div></div> <div class="paragraph"><p>The runscript method is a brute force way to run scripts where the user is responsible for setting STATE and STATUS</p></div> <div class="listingblock"> <div class="content"> <pre><tt>runscript main.csh</tt></pre> </div></div> </div> </div> <div class="sect2"> <h3 id="_requirements_section">Requirements section</h3> <div class="sect3"> <h4 id="_header_2">Header</h4> <div class="listingblock"> <div class="content"> <pre><tt>[requirements]</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_wait_on_other_tests">Wait on Other Tests</h4> <div class="listingblock"> <div class="content"> <pre><tt># A normal waiton waits for the prior tests to be COMPLETED # and PASS, CHECK or WAIVED waiton test1 test2</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_mode">Mode</h4> <div class="paragraph"><p>The default (i.e. if mode is not specified) is normal. All pre-dependent tests must be COMPLETED and PASS, CHECK or WAIVED before the test will start</p></div> <div class="listingblock"> <div class="content"> <pre><tt>mode normal</tt></pre> </div></div> <div class="paragraph"><p>The toplevel mode requires only that the prior tests are COMPLETED.</p></div> |
︙ | ︙ | |||
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | <div class="listingblock"> <div class="content"> <pre><tt># With a toplevel test you may wish to generate your list # of tests to run dynamically # # waiton #{shell get-valid-tests-to-run.sh}</tt></pre> </div></div> <div class="listingblock"> <div class="content"> <pre><tt>runtimelim 1h 2m 3s # this will automatically kill the test if it runs for more than 1h 2m and 3s</tt></pre> </div></div> <div class="listingblock"> <div class="content"> <pre><tt>[skip]</tt></pre> </div></div> <div class="listingblock"> <div class="content"> <pre><tt># NB// If the prevrunning line exists with *any* value the test will # automatically SKIP if the same-named test is currently RUNNING prevrunning x</tt></pre> </div></div> <div class="listingblock"> <div class="content"> <pre><tt>fileexists /path/to/a/file # skip if /path/to/a/file exists</tt></pre> </div></div> <div class="paragraph"><p>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</p></div> <div class="paragraph"><p>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)</p></div> <div class="listingblock"> <div class="content"> <pre><tt>###### EXAMPLE FROM testconfig ######### # matching file(s) will be diff'd with previous run and logpro applied | > > > > > > > > > > > > > > > > > > | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | <div class="listingblock"> <div class="content"> <pre><tt># With a toplevel test you may wish to generate your list # of tests to run dynamically # # waiton #{shell get-valid-tests-to-run.sh}</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_run_time_limit">Run time limit</h4> <div class="listingblock"> <div class="content"> <pre><tt>runtimelim 1h 2m 3s # this will automatically kill the test if it runs for more than 1h 2m and 3s</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_skip">Skip</h4> </div> <div class="sect3"> <h4 id="_header_3">Header</h4> <div class="listingblock"> <div class="content"> <pre><tt>[skip]</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_skip_on_still_running_tests">Skip on Still-running Tests</h4> <div class="listingblock"> <div class="content"> <pre><tt># NB// If the prevrunning line exists with *any* value the test will # automatically SKIP if the same-named test is currently RUNNING prevrunning x</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_skip_if_a_file_exists">Skip if a File Exists</h4> <div class="listingblock"> <div class="content"> <pre><tt>fileexists /path/to/a/file # skip if /path/to/a/file exists</tt></pre> </div></div> </div> <div class="sect3"> <h4 id="_controlled_waiver_propagation">Controlled waiver propagation</h4> <div class="paragraph"><p>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</p></div> <div class="paragraph"><p>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)</p></div> <div class="listingblock"> <div class="content"> <pre><tt>###### EXAMPLE FROM testconfig ######### # matching file(s) will be diff'd with previous run and logpro applied |
︙ | ︙ | |||
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | # This builtin rule is the default if there is no <waivername>.logpro file # diff diff %file1% %file2% # This builtin rule is applied if a <waivername>.logpro file exists # logpro diff %file1% %file2% | logpro %waivername%.logpro %waivername%.html</tt></pre> </div></div> <div class="paragraph"><p>To transfer the environment to the next step you can do the following:</p></div> <div class="listingblock"> <div class="content"> <pre><tt>$MT_MEGATEST -env2file .ezsteps/${stepname}</tt></pre> </div></div> <div class="sect2"> <h3 id="_megatest_internals">Megatest Internals</h3> <div class="imageblock graphviz"> <div class="content"> <img src="server.png" alt="server.png" /> </div> </div> </div> <div class="paragraph"><p>One or more optional appendixes go here at section level zero.</p></div> <div class="admonitionblock"> <table><tr> <td class="icon"> <div class="title">Note</div> </td> <td class="content">Preface and appendix subsections start out of sequence at level 2 (level 1 is skipped). This only applies to multi-part book documents.</td> </tr></table> </div> <div class="paragraph"><p>The bibliography list is a style of AsciiDoc bulleted list.</p></div> <div class="ulist bibliography"><ul> <li> <p> <a id="taoup"></a>[taoup] Eric Steven Raymond. <em>The Art of Unix Programming</em>. Addison-Wesley. ISBN 0-13-142901-9. </p> </li> <li> <p> <a id="walsh-muellner"></a>[walsh-muellner] Norman Walsh & Leonard Muellner. <em>DocBook - The Definitive Guide</em>. O’Reilly & Associates. 1999. ISBN 1-56592-580-7. </p> </li> </ul></div> <div class="paragraph"><p>Glossaries are optional. Glossaries entries are an example of a style of AsciiDoc labeled lists.</p></div> <div class="dlist glossary"><dl> <dt> A glossary term </dt> <dd> <p> The corresponding (indented) definition. </p> </dd> <dt> A second glossary term </dt> <dd> <p> The corresponding (indented) definition. </p> </dd> </dl></div> <div class="paragraph"><p>Text at the end of a book describing facts about its production.</p></div> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > | | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | # This builtin rule is the default if there is no <waivername>.logpro file # diff diff %file1% %file2% # This builtin rule is applied if a <waivername>.logpro file exists # logpro diff %file1% %file2% | logpro %waivername%.logpro %waivername%.html</tt></pre> </div></div> </div> </div> <div class="sect2"> <h3 id="_ezsteps">Ezsteps</h3> <div class="paragraph"><p>To transfer the environment to the next step you can do the following:</p></div> <div class="listingblock"> <div class="content"> <pre><tt>$MT_MEGATEST -env2file .ezsteps/${stepname}</tt></pre> </div></div> </div> <div class="sect2"> <h3 id="_triggers">Triggers</h3> <div class="paragraph"><p>In your testconfig triggers can be specified</p></div> <div class="listingblock"> <div class="content"> <pre><tt>[triggers] # Call script running.sh when test goes to state=RUNNING, status=PASS RUNNING/PASS running.sh # Call script running.sh any time state goes to RUNNING RUNNING/ running.sh # Call script onpass.sh any time status goes to PASS PASS/ onpass.sh</tt></pre> </div></div> </div> <div class="sect2"> <h3 id="_megatest_internals">Megatest Internals</h3> <div class="imageblock graphviz"> <div class="content"> <img src="server.png" alt="server.png" /> </div> </div> </div> </div> </div> <div class="sect1"> <h2 id="_example_appendix">Appendix A: Example Appendix</h2> <div class="sectionbody"> <div class="paragraph"><p>One or more optional appendixes go here at section level zero.</p></div> <div class="sect2"> <h3 id="_appendix_sub_section">Appendix Sub-section</h3> <div class="admonitionblock"> <table><tr> <td class="icon"> <div class="title">Note</div> </td> <td class="content">Preface and appendix subsections start out of sequence at level 2 (level 1 is skipped). This only applies to multi-part book documents.</td> </tr></table> </div> </div> </div> </div> <div class="sect1"> <h2 id="_example_bibliography">Example Bibliography</h2> <div class="sectionbody"> <div class="paragraph"><p>The bibliography list is a style of AsciiDoc bulleted list.</p></div> <div class="ulist bibliography"><ul> <li> <p> <a id="taoup"></a>[taoup] Eric Steven Raymond. <em>The Art of Unix Programming</em>. Addison-Wesley. ISBN 0-13-142901-9. </p> </li> <li> <p> <a id="walsh-muellner"></a>[walsh-muellner] Norman Walsh & Leonard Muellner. <em>DocBook - The Definitive Guide</em>. O’Reilly & Associates. 1999. ISBN 1-56592-580-7. </p> </li> </ul></div> </div> </div> <div class="sect1"> <h2 id="_example_glossary">Example Glossary</h2> <div class="sectionbody"> <div class="paragraph"><p>Glossaries are optional. Glossaries entries are an example of a style of AsciiDoc labeled lists.</p></div> <div class="dlist glossary"><dl> <dt> A glossary term </dt> <dd> <p> The corresponding (indented) definition. </p> </dd> <dt> A second glossary term </dt> <dd> <p> The corresponding (indented) definition. </p> </dd> </dl></div> </div> </div> <div class="sect1"> <h2 id="_example_colophon">Example Colophon</h2> <div class="sectionbody"> <div class="paragraph"><p>Text at the end of a book describing facts about its production.</p></div> </div> </div> <div class="sect1"> <h2 id="_example_index">Example Index</h2> <div class="sectionbody"> </div> </div> </div> <div id="footnotes"><hr /></div> <div id="footer"> <div id="footer-text"> Version 1.0<br /> Last updated 2014-09-12 13:35:39 MST </div> </div> </body> </html> |
Modified docs/manual/reference.txt from [b45aa0231c] to [eff8aa5426].
︙ | ︙ | |||
146 147 148 149 150 151 152 153 154 | To transfer the environment to the next step you can do the following: ---------------------------- $MT_MEGATEST -env2file .ezsteps/${stepname} ---------------------------- :numbered!: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | To transfer the environment to the next step you can do the following: ---------------------------- $MT_MEGATEST -env2file .ezsteps/${stepname} ---------------------------- Triggers ~~~~~~~~ In your testconfig triggers can be specified ----------------- [triggers] # Call script running.sh when test goes to state=RUNNING, status=PASS RUNNING/PASS running.sh # Call script running.sh any time state goes to RUNNING RUNNING/ running.sh # Call script onpass.sh any time status goes to PASS PASS/ onpass.sh ----------------- Scripts called will have; test-id test-rundir trigger, added to the commandline. HINT To start an xterm (useful for debugging), use a command line like the following: ----------------- [triggers] COMPLETED/ xterm -e bash -s -- ----------------- NOTE: There is a trailing space after the -- :numbered!: |
Modified docs/manual/server.png from [ae7d7ee58e] to [da39a3ee5e].
cannot compute difference between binary files
Modified tests/fullrun/tests/exit_0/testconfig from [475b97c77b] to [5010ef5eb6].
1 2 3 4 5 6 7 8 9 10 | [setup] runscript main.sh [test_meta] author matt owner bob description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS tags first,single reviewed 09/10/2011, by Matt | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [setup] runscript main.sh [test_meta] author matt owner bob description This test checks that a multi-lineitem test with mix of pass and non-fail rolls up a PASS tags first,single reviewed 09/10/2011, by Matt [triggers] NOT_STARTED/ xterm -e bash -s -- RUNNING/ xterm -e bash -s -- |