Index: common.scm
==================================================================
--- common.scm
+++ common.scm
@@ -162,10 +162,11 @@
;; (define *max-cache-size* 0)
(define *logged-in-clients* (make-hash-table))
(define *server-id* #f)
(define *server-info* #f) ;; good candidate for easily convert to non-global
(define *time-to-exit* #f)
+(define *time-to-exit-cleanup-thunk-list '())
(define *server-run* #t)
(define *run-id* #f)
(define *server-kind-run* (make-hash-table))
(define *home-host* #f)
;; (define *total-non-write-delay* 0)
@@ -890,10 +891,18 @@
(define (std-exit-procedure)
;;(common:telemetry-log-close)
(on-exit (lambda () 0))
+
+ (for-each (lambda (thunk)
+ (handle-exceptions
+ exn
+ (debug:print 0 *default-log-port* "WARNING: exception while running on-exit thunk item")
+ (thunk)))
+ *time-to-exit-cleanup-thunk-list*)
+
;;(debug:print-info 13 *default-log-port* "std-exit-procedure called; *time-to-exit*="*time-to-exit*)
(let ((no-hurry (if *time-to-exit* ;; hurry up
#f
(begin
(set! *time-to-exit* #t)
ADDED docs/manual/debug_techniques.txt
Index: docs/manual/debug_techniques.txt
==================================================================
--- /dev/null
+++ docs/manual/debug_techniques.txt
@@ -0,0 +1,89 @@
+// This file is part of Megatest.
+//
+// Megatest is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Megatest is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Megatest. If not, see
A single, stand-alone, Megatest based testsuite or "area" is -sufficient for most validation, automation and build problems.
Megatest is designed as a distributed or decoupled system. This means -you can run the areas stand-alone with no additional -infrastructure. I.e. there are no databases, web servers or other -centralized resources needed. However as your needs grow you can -integrate multiple areas into a bigger system.
-Multi-area dashboard and xterm. A gui (the dashboard) is usually the - best option for controlling and launching runs but all operations - can also be done from the commandline. Note: The not yet released - multi-area dashboard replaces the old dashboard for browsing and - controlling runs but for managing a single area the old dashboard - works very well. -
--Area/testsuite. This is your testsuite or automation definition and - consists of the information in megatest.config, runconfigs.config - and your testconfigs along with any custom scripting that can’t be - done with the native Megatest features. -
--If your testsuite or build automation is too large to run on a - single instance you can distribute your jobs into a compute server - pool. The only current requirements are password-less ssh access and - a network filesystem. -
-this page intentionally left blank
This test runs a single step called "stepname1" which runs a script "stepname.sh". Note that although it is common to put the actions needed for a test step into a script it is not necessary.
From the dashboard click on the button (PASS/FAIL…) for one of the tests. From the test control panel that -comes up push the clean test button. The command field will be prefilled with a template command for removing -that test. You can edit the command, for example change the argument to -testpatt to "%" to remove all tests.
megatest -remove-runs -target ubuntu/nfs/none -runname ww28.1a -testpatt diskperf/% -v-
megatest -remove-runs -target %/%/% -runname % -testpatt % -v-
Megatest supports using the bup backup tool (https://bup.github.io/) to archive your tests for efficient storage -and retrieval. Archived data can be rapidly retrieved if needed. The metadata for the run (PASS/FAIL status, run -durations, time stamps etc.) are all preserved in the megatest database.
For setup information see the Archiving topic in the reference section of this manual.
Hint: use the test control panel to create a template command by pushing the "Archive Tests" button.
megatest -target ubuntu/nfs/none -runname ww28.1a -archive save-remove -testpatt %-
megatest -target ubuntu/nfs/none -runname ww28.1a -archive restore -testpatt diskperf/%-
Hint: You can browse the archive using bup commands directly.
bup -d /path/to/bup/archive ftp-
[host-types] -general ssh #{getbgesthost general} -nbgeneral nbjob run JOBCOMMAND -log $MT_LINKTREE/$MT_TARGET/$MT_RUNNAME.$MT_TESTNAME-$MT_ITEM_PATH.lgo - -[hosts] -general cubian xena - -[launchers] -envsetup general -xor/%/n 4C16G -% nbgeneral - -[jobtools] -launcher bsub -# if defined and not "no" flexi-launcher will bypass launcher unless there is no -# match. -flexi-launcher yes-
This section is a compendium of a various useful tricks for debugging, -configuring and generally getting the most out of Megatest.
The following example will limit a test in the jobgroup "group1" to no more than 10 tests simultaneously.
In your testconfig:
[test_meta] -jobgroup group1-
In your megatest.config:
[jobgroups] -group1 10 -custdes 4-
From the dashboard click on a test PASS/FAIL button. This brings up a test control panel. Aproximately near the center left of the -window there is a button "Start Xterm". Push this to get an xterm with the full context and environment loaded for that test. You can run -scripts or ezsteps by copying from the testconfig (hint, load up the testconfig in a separate gvim or emacs window). This is the easiest way -to debug your tests.
It is often helpful to know the content of variables in various -contexts as Megatest does the actions needed to run your tests. A handy technique is to force the startup of an xterm in the context being examined.
For example, if an item list is not being generated as expected you -can inject the startup of an xterm as if it were an item:
[items] -CELLNAME [system getcellname.sh]-
[items] -DEBUG [system xterm] -CELLNAME [system getcellnames.sh]-
When this test is run an xterm will pop up. In that xterm the -environment is exactly that in which the script "getcellnames.sh" -would run. You can now debug the script to find out why it isn’t -working as expected.
The default location "tests" for storing tests can be extended by -adding to your tests-paths section.
[misc] -parent #{shell dirname $(readlink -f .)} - -[tests-paths] -1 #{get misc parent}/simplerun/tests-
The above example shows how you can use addition sections in your -config file to do complex processing. By putting results of relatively -slow operations into variables the processing of your configs can be -kept fast.
[setup] -runscript main.csh-
The runscript method is essentially a brute force way to run scripts where the -user is responsible for setting STATE and STATUS and managing the details of running a test.
Some handy Unix commands to track down issues with servers not -communicating with your test manager processes. Please put in tickets -at https://www.kiatoa.com/fossils/megatest if you have problems with -servers getting stuck.
sudo lsof -i -sudo netstat -lptu -sudo netstat -tulpn-
include:howto.txt[]
[host-types] general nbfake @@ -2658,10 +2420,290 @@
Megatest is an extensive program with a lot to learn. Following are some paths through the material to smooth the learning path.
+Components of automation; run, test, iteration +
++Selectors; target, runname, and testpatt +
++Using the dashboard gui (recommended) +
++Using the "Runs" panel. +
++Using the "Run Control" panel. +
++Using a test control panel +
++The Right Mouse Button menu +
++Debug features +
++xterm +
++pstree +
++log files; mt_copy.log, mt_launch.log +
++variables; megatest.csh, megatest.sh +
++testconfig dump, *testconfig +
++State/status buttons +
++Run, Clean, KillReq +
++ReRunClean +
++Using the command line +
++Getting help; megatest -h, megatest -manual +
++Starting runs; megatest -run +
++Selection controls; -target, -runname and -testpatt +
++environment variables (table 5) +
++tests/testname/testconfig testconfig details +
++ezsteps and logpro section +
++iteration (one test applied to many inputs), items, itemstable test iteration +
++dependencies, waiton, itemmatch, itemwait test requirements +
++miscellaneous; mode toplevel, runtimelim, skip on file or on running, waiver propagation +
++megatest areas +
++megatest.config +
++runconfigs.config +
++config language features; include, shell, system, scheme, rp|realpath, getenv, get, rget, scriptinc config file helpers +
++Removing and keeping runs selectively managing runs +
++Subruns nested runs +
++Config file features config file features +
++HTML output with -generate-html +
++Triggers, post run, state/status +
++MTLOWESTLOAD +
++flexilauncher +
++env delta and testconfig +
++capturing test data, extracting values from logpro and using them for pass/fail +
++mtutil, postgres connection, packets for cross-site/cross-user control (e.g. mcrun). +
++cleanup-db, database structure of Megatest 1.6x +
++archiving +
++homehost management +
++show-runconfig +
++show-config +
++show with -debug 0,9 +
++load management +
+