summaryrefslogtreecommitdiff
path: root/storage/ndb/test/run-test
diff options
context:
space:
mode:
Diffstat (limited to 'storage/ndb/test/run-test')
-rw-r--r--storage/ndb/test/run-test/16node-tests.txt733
-rw-r--r--storage/ndb/test/run-test/Makefile.am29
-rw-r--r--storage/ndb/test/run-test/README43
-rw-r--r--storage/ndb/test/run-test/README.ATRT34
-rwxr-xr-xstorage/ndb/test/run-test/atrt-analyze-result.sh12
-rwxr-xr-xstorage/ndb/test/run-test/atrt-clear-result.sh4
-rw-r--r--storage/ndb/test/run-test/atrt-example.tgzbin0 -> 2196 bytes
-rwxr-xr-xstorage/ndb/test/run-test/atrt-gather-result.sh16
-rwxr-xr-xstorage/ndb/test/run-test/atrt-mysql-test-run18
-rwxr-xr-xstorage/ndb/test/run-test/atrt-setup.sh6
-rwxr-xr-xstorage/ndb/test/run-test/atrt-testBackup6
-rw-r--r--storage/ndb/test/run-test/basic.txt763
-rw-r--r--storage/ndb/test/run-test/daily-basic-tests.txt584
-rw-r--r--storage/ndb/test/run-test/daily-devel-tests.txt210
-rw-r--r--storage/ndb/test/run-test/example.conf10
-rw-r--r--storage/ndb/test/run-test/main.cpp1004
-rwxr-xr-xstorage/ndb/test/run-test/make-config.sh465
-rwxr-xr-xstorage/ndb/test/run-test/make-html-reports.sh192
-rwxr-xr-xstorage/ndb/test/run-test/make-index.sh242
-rwxr-xr-xstorage/ndb/test/run-test/ndb-autotest.sh228
-rw-r--r--storage/ndb/test/run-test/run-test.hpp95
21 files changed, 4694 insertions, 0 deletions
diff --git a/storage/ndb/test/run-test/16node-tests.txt b/storage/ndb/test/run-test/16node-tests.txt
new file mode 100644
index 00000000000..11ade56c28c
--- /dev/null
+++ b/storage/ndb/test/run-test/16node-tests.txt
@@ -0,0 +1,733 @@
+# BASIC FUNCTIONALITY
+max-time: 500
+cmd: testBasic
+args: -n PkRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkUpdate
+
+max-time: 500
+cmd: testBasic
+args: -n PkDelete
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsert
+
+max-time: 600
+cmd: testBasic
+args: -n UpdateAndRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker2 T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadUpdateAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n ReadWithLocksAndInserts T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsertTwice T1 T6 T10
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T13
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitSleep T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback626 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackUpdate T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackDeleteMultiple T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n ImplicitRollbackDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackNothing T1 T6
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkInsertAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkReadAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkUpdateAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkDeleteAsynch
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback T1 T6 T13
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback2 T1 T6 T13
+
+max-time: 500
+cmd: testTimeout
+args: T1
+
+# SCAN TESTS
+#
+max-time: 500
+cmd: testScan
+args: -n ScanRead16
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead240
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadCommitted240
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate2 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete2 T10
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAndScanRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndLocker T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndPkRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488 -l 10 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488O -l 10 T6
+
+max-time: 1000
+cmd: testScan
+args: -n ScanRead488_Mixed -l 10 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488Timeout -l 10 T6
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T2
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead100 -l 100 T1
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T1
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead40RandomTable -l 100 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanWithLocksAndInserts T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort15 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort240 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAbort16 T6
+
+max-time: 3600
+cmd: testScan
+args: -n ScanReadRestart T1 T6 T13
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateRestart T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckGetValue T6
+
+max-time: 500
+cmd: testScan
+args: -n CloseWithoutStop T6
+
+max-time: 500
+cmd: testScan
+args: -n NextScanWhenNoMore T6
+
+max-time: 500
+cmd: testScan
+args: -n ExecuteScanWithoutOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOpenScanOnce T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpInScanTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpBeforeOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneScanPerTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n NoCloseTransaction T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityTimeOut T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityBeforeClose T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5021 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReaderror5022 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5023 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5024 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5025 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5030 T1
+
+max-time: 500
+cmd: testScan
+args: -n InsertDelete T1 T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadWhileNodeIsDown T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanRestart T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanParallelism
+
+#
+# DICT TESTS
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDrop
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropWithData
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropDuring T6 T10
+
+max-time: 1500
+cmd: testDict
+args: -n CreateInvalidTables
+
+max-time: 1500
+cmd: testDict
+args: -n CreateTableWhenDbIsFull T6
+
+max-time: 1500
+cmd: testDict
+args: -n CreateMaxTables T6
+
+max-time: 500
+cmd: testDict
+args: -n FragmentTypeSingle T1
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllSmall T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllLarge T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n TemporaryTables T1 T6 T7 T8
+
+#
+# TEST NDBAPI
+#
+max-time: 500
+cmd: testDataBuffers
+args:
+
+# Testsuite: testNdbApi
+# Number of tests: 5
+max-time: 500
+cmd: testNdbApi
+args: -n MaxNdb T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxTransactions T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxOperations T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxGetValue T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxEqual
+
+max-time: 500
+cmd: testNdbApi
+args: -n DeleteNdb T1 T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n WaitUntilReady T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetOperationNoTab T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n NdbErrorOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MissingOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetValueInUpdate T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutKeys T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutValues T6
+
+#max-time: 500
+#cmd: testInterpreter
+#args: T1
+#
+max-time: 150000
+cmd: testOperations
+args:
+
+max-time: 15000
+cmd: testTransactions
+args:
+
+max-time: 1500
+cmd: testRestartGci
+args: T6
+
+max-time: 600
+cmd: testBlobs
+args:
+
+max-time: 5000
+cmd: testOIBasic
+args:
+
+max-time: 2500
+cmd: testBitfield
+args:
+
+max-time: 2500
+cmd: testPartitioning
+args:
+
+max-time: 25000
+cmd: atrt-mysql-test-run
+args: --force
+
+#
+# INDEX
+#
+max-time: 1500
+cmd: testIndex
+args: -n CreateAll T1 T6 T13
+
+#-m 7200 1: testIndex -n InsertDeleteGentle T7
+max-time: 3600
+cmd: testIndex
+args: -n InsertDelete T1 T10
+
+#-m 3600 1: testIndex -n CreateLoadDropGentle T7
+max-time: 3600
+cmd: testIndex
+args: -n CreateLoadDrop T1 T10
+
+#
+# BACKUP
+#
+max-time: 600
+cmd: atrt-testBackup
+args: -n BackupOne T1 T6 T3 I3
+
+#
+#
+# SYSTEM RESTARTS
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR3 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR4 T6
+
+#
+# NODE RESTARTS
+#
+max-time: 2500
+cmd: testNodeRestart
+args: -n NoLoad T6
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n MixedPkRead T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -l 1 -n MixedPkReadPkUpdate
+
+max-time: 2500
+cmd: testNodeRestart
+args: -l 1 -n MixedReadUpdateScan
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n CommittedRead T1
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FullDb T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNode T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNodeError T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNodeInitial T6 T13
+
+max-time: 3600
+cmd: testNodeRestart
+args: -l 1 -n RestartNFDuringNR T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartMasterNodeError T6 T8 T13
+
+max-time: 3600
+cmd: testNodeRestart
+args: -n RestartNodeDuringLCP T6
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n TwoNodeFailure T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n TwoMasterNodeFailure T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FiftyPercentFail T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodes T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesAbort T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesError9999 T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FiftyPercentStopAndWait T6 T8 T13
+
+#max-time: 500
+#cmd: testNodeRestart
+#args: -n StopOnError T1
+#
+#
+max-time: 2500
+cmd: testIndex
+args: -n NFNR1 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR2 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR3 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n BuildDuring T6
+
+max-time: 2500
+cmd: testIndex
+args: -l 2 -n SR1 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR1_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR2_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR3_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n BuildDuring_O T6
+
+max-time: 2500
+cmd: testIndex
+args: -l 2 -n SR1_O T6 T13
+
+max-time: 500
+cmd: testIndex
+args: -n MixedTransaction T1
+
+max-time: 2500
+cmd: testDict
+args: -n NF1 T1 T6 T13
+
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR6 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR7 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR8 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR9 T1
+
+#
+max-time: 2500
+cmd: test_event
+args: -n BasicEventOperation T1 T6
+
+#
+#
+# SYSTEM RESTARTS
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T8
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T8
+
+# OLD FLEX
+max-time: 500
+cmd: flexBench
+args: -c 25 -t 10
+
+max-time: 500
+cmd: flexHammer
+args: -r 5 -t 32
+
diff --git a/storage/ndb/test/run-test/Makefile.am b/storage/ndb/test/run-test/Makefile.am
new file mode 100644
index 00000000000..1067328dcc3
--- /dev/null
+++ b/storage/ndb/test/run-test/Makefile.am
@@ -0,0 +1,29 @@
+
+testdir=$(prefix)/mysql-test/ndb
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_util.mk.am
+include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
+
+test_PROGRAMS = atrt
+test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt
+test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
+ atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
+
+atrt_SOURCES = main.cpp run-test.hpp
+INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
+LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
+ $(top_builddir)/ndb/src/libndbclient.la \
+ $(top_builddir)/dbug/libdbug.a \
+ $(top_builddir)/mysys/libmysys.a \
+ $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+
+wrappersdir=$(prefix)/bin
+wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
+
+EXTRA_DIST = $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
+
+windoze-dsp:
diff --git a/storage/ndb/test/run-test/README b/storage/ndb/test/run-test/README
new file mode 100644
index 00000000000..d5da8f05c17
--- /dev/null
+++ b/storage/ndb/test/run-test/README
@@ -0,0 +1,43 @@
+run-test/README
+
+This document describes how atrt works and how to use it.
+
+atrt is a test program driver.
+atrt supports fully distributed test and utilizes ndb_cpcd.
+
+=================================
+atrt has the following main loop:
+
+/**
+ * Psuedo code for atrt
+ */
+ read config file (default d.txt)
+ contact each ndb_cpcd
+ start each ndb_mgmd
+ connect to each ndb_mgmd
+ for each read(test case)
+ do
+ if previous test failed (or is first test)
+ stop each ndbd
+ start each ndbd
+ wait for ndbd to get started
+
+ start each mysqld
+
+ start each test prg
+
+ wait while all is running and max time not elapsed
+
+ stop each mysqld
+
+ stop each test prg
+
+ gather result
+
+ done
+/**
+ * End of psuedo code
+ */
+
+=================================
+
diff --git a/storage/ndb/test/run-test/README.ATRT b/storage/ndb/test/run-test/README.ATRT
new file mode 100644
index 00000000000..7fe04ccdac4
--- /dev/null
+++ b/storage/ndb/test/run-test/README.ATRT
@@ -0,0 +1,34 @@
+
+!-- install ndb_cpcd
+!-- many steps? future RPM
+
+!-- deploy binaries and libraries to hosts, rsync
+% export DEPLOY_DST="mc05:/space/tomas/keso"
+% ssh mc05 mkdir /space/tomas/keso
+% export RSYNC_RSH=ssh
+% make
+
+% mkdir -p /tmp/atrt-run-2-node
+% cd /tmp/atrt-run-2-node
+% cat > d.txt
+baseport: 9321
+basedir: /space/tomas/keso
+mgm: localhost
+ndb: localhost localhost
+api: localhost
+% cat > default.txt
+[DB DEFAULT]
+NoOfReplicas: 2
+% bin/make-config.sh -m d.txt -t default.txt -d .
+
+% atrt -v -v
+test_event -r 5 T1
+
+
+!-- check output
+% tail -f /space/tomas/keso/run/4.ndb_api/log.out
+
+
+!-- check processes
+% export NDB_CPCC_HOSTS="mc05"
+% ndb_cpcc
diff --git a/storage/ndb/test/run-test/atrt-analyze-result.sh b/storage/ndb/test/run-test/atrt-analyze-result.sh
new file mode 100755
index 00000000000..0fa46e918ef
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-analyze-result.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+f=`find result -name 'log.out' | xargs grep "NDBT_ProgramExit: " | grep -c "Failed"`
+o=`find result -name 'log.out' | xargs grep "NDBT_ProgramExit: " | grep -c "OK"`
+
+if [ $o -gt 0 -a $f -eq 0 ]
+then
+ exit 0
+fi
+
+exit 1
+
diff --git a/storage/ndb/test/run-test/atrt-clear-result.sh b/storage/ndb/test/run-test/atrt-clear-result.sh
new file mode 100755
index 00000000000..57d3d43d247
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-clear-result.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+set -e
+rm -rf result
diff --git a/storage/ndb/test/run-test/atrt-example.tgz b/storage/ndb/test/run-test/atrt-example.tgz
new file mode 100644
index 00000000000..8455b2eb00d
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-example.tgz
Binary files differ
diff --git a/storage/ndb/test/run-test/atrt-gather-result.sh b/storage/ndb/test/run-test/atrt-gather-result.sh
new file mode 100755
index 00000000000..93d4ae428d0
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-gather-result.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+mkdir -p result
+cd result
+rm -rf *
+
+while [ $# -gt 0 ]
+do
+ rsync -a "$1" .
+ shift
+done
+
+
+
diff --git a/storage/ndb/test/run-test/atrt-mysql-test-run b/storage/ndb/test/run-test/atrt-mysql-test-run
new file mode 100755
index 00000000000..2ebc11b0070
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-mysql-test-run
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -x
+p=`pwd`
+cd $MYSQL_BASE_DIR/mysql-test
+./mysql-test-run --with-ndbcluster --ndb-connectstring=$NDB_CONNECTSTRING $* | tee $p/output.txt
+
+f=`grep -c '\[ fail \]' $p/output.txt`
+o=`grep -c '\[ pass \]' $p/output.txt`
+
+if [ $o -gt 0 -a $f -eq 0 ]
+then
+ echo "NDBT_ProgramExit: OK"
+ exit 0
+fi
+
+echo "NDBT_ProgramExit: Failed"
+exit 1
diff --git a/storage/ndb/test/run-test/atrt-setup.sh b/storage/ndb/test/run-test/atrt-setup.sh
new file mode 100755
index 00000000000..aff5d4119dc
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-setup.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+
+ssh $1 mkdir -p $3
+rsync -a --delete --force --ignore-errors $2 $1:$3
diff --git a/storage/ndb/test/run-test/atrt-testBackup b/storage/ndb/test/run-test/atrt-testBackup
new file mode 100755
index 00000000000..3ed7641a42e
--- /dev/null
+++ b/storage/ndb/test/run-test/atrt-testBackup
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+PATH=$PATH:$MYSQL_BASE_DIR/bin
+export PATH
+
+testBackup $*
diff --git a/storage/ndb/test/run-test/basic.txt b/storage/ndb/test/run-test/basic.txt
new file mode 100644
index 00000000000..ec9e21359e5
--- /dev/null
+++ b/storage/ndb/test/run-test/basic.txt
@@ -0,0 +1,763 @@
+# BASIC FUNCTIONALITY
+max-time: 500
+cmd: testBasic
+args: -n PkRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkUpdate
+
+max-time: 500
+cmd: testBasic
+args: -n PkDelete
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsert
+
+max-time: 600
+cmd: testBasic
+args: -n UpdateAndRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker2 T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadUpdateAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n ReadWithLocksAndInserts T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsertTwice T1 T6 T10
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T1
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitSleep T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback626 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackUpdate T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackDeleteMultiple T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n ImplicitRollbackDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackNothing T1 T6
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkInsertAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkReadAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkUpdateAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkDeleteAsynch
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback T1 T6 T13
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback2 T1 T6 T13
+
+#-m 500 1: testBasic -n ReadConsistency T6
+cmd: testTimeout
+args: -n DontTimeoutTransaction T1
+
+cmd: testTimeout
+args: -n DontTimeoutTransaction5 T1
+
+cmd: testTimeout
+args: -n TimeoutTransaction T1
+
+cmd: testTimeout
+args: -n TimeoutTransaction5 T1
+
+cmd: testTimeout
+args: -n BuddyTransNoTimeout T1
+
+cmd: testTimeout
+args: -n BuddyTransNoTimeout5 T1
+
+#
+# SCAN TESTS
+#
+max-time: 500
+cmd: testScan
+args: -n ScanRead16
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead240
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadCommitted240
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate2 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete2 T10
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAndScanRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndLocker T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndPkRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488 -l 10 T6
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T2
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead100 -l 100 T1
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T1
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead40RandomTable -l 100 T1
+
+max-time: 3600
+cmd: testScan
+args: -n ScanRead40RandomTable -l 1000 T2
+
+max-time: 500
+cmd: testScan
+args: -n ScanWithLocksAndInserts T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort15 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort240 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAbort16 T6
+
+max-time: 3600
+cmd: testScan
+args: -n ScanReadRestart T1 T6 T13
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateRestart T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckGetValue T6
+
+max-time: 500
+cmd: testScan
+args: -n CloseWithoutStop T6
+
+max-time: 500
+cmd: testScan
+args: -n NextScanWhenNoMore T6
+
+max-time: 500
+cmd: testScan
+args: -n ExecuteScanWithoutOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOpenScanOnce T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpInScanTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpBeforeOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneScanPerTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n NoCloseTransaction T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityTimeOut T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityBeforeClose T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5021 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReaderror5022 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5023 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5024 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5025 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5030 T1
+
+# OLD FLEX
+max-time: 500
+cmd: flexBench
+args: -c 25 -t 10
+
+max-time: 500
+cmd: flexHammer
+args: -r 5 -t 32
+
+#
+# DICT TESTS
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDrop
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropWithData
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropDuring T6 T10
+
+max-time: 1500
+cmd: testDict
+args: -n CreateInvalidTables
+
+max-time: 1500
+cmd: testDict
+args: -n CreateTableWhenDbIsFull T6
+
+max-time: 1500
+cmd: testDict
+args: -n CreateMaxTables T6
+
+max-time: 500
+cmd: testDict
+args: -n FragmentTypeSingle T1
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllSmall T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllLarge T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n TemporaryTables T1 T6 T7 T8
+
+#
+# TEST NDBAPI
+#
+max-time: 500
+cmd: testDataBuffers
+args:
+
+# Testsuite: testNdbApi
+# Number of tests: 5
+max-time: 500
+cmd: testNdbApi
+args: -n MaxNdb T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxTransactions T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxOperations T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxGetValue T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxEqual
+
+max-time: 500
+cmd: testNdbApi
+args: -n DeleteNdb T1 T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n WaitUntilReady T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetOperationNoTab T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n NdbErrorOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MissingOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetValueInUpdate T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutKeys T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutValues T6
+
+max-time: 500
+cmd: testInterpreter
+args: T1
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteDirtyRead
+
+max-time: 1500
+cmd: testRestartGci
+args: T6
+
diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt
new file mode 100644
index 00000000000..8528e709eb3
--- /dev/null
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt
@@ -0,0 +1,584 @@
+max-time: 3600
+cmd: atrt-mysql-test-run
+args: --force
+
+max-time: 600
+cmd: atrt-testBackup
+args: -n BackupOne T1 T6 T3 I3
+
+# BASIC FUNCTIONALITY
+max-time: 500
+cmd: testBasic
+args: -n PkRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkUpdate
+
+max-time: 500
+cmd: testBasic
+args: -n PkDelete
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsert
+
+max-time: 660
+cmd: testBasic
+args: -n UpdateAndRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker2 T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadUpdateAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n ReadWithLocksAndInserts T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsertTwice T1 T6 T10
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T13
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitSleep T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback626 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackUpdate T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackDeleteMultiple T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n ImplicitRollbackDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackNothing T1 T6
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkInsertAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkReadAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkUpdateAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkDeleteAsynch
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback T1 T6 T13
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback2 T1 T6 T13
+
+max-time: 500
+cmd: testTimeout
+args: T1
+
+# SCAN TESTS
+#
+max-time: 500
+cmd: testScan
+args: -n ScanRead16
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead240
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadCommitted240
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate2 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete2 T10
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAndScanRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndLocker T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndPkRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488 -l 10 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488O -l 10 T6
+
+max-time: 1000
+cmd: testScan
+args: -n ScanRead488_Mixed -l 10 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488Timeout -l 10 T6
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T2
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead100 -l 100 T1
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T1
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead40RandomTable -l 100 T1
+
+max-time: 3600
+cmd: testScan
+args: -n ScanRead40RandomTable -l 1000 T2
+
+max-time: 500
+cmd: testScan
+args: -n ScanWithLocksAndInserts T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort15 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort240 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAbort16 T6
+
+max-time: 3600
+cmd: testScan
+args: -n ScanReadRestart T1 T6 T13
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateRestart T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckGetValue T6
+
+max-time: 500
+cmd: testScan
+args: -n CloseWithoutStop T6
+
+max-time: 500
+cmd: testScan
+args: -n NextScanWhenNoMore T6
+
+max-time: 500
+cmd: testScan
+args: -n ExecuteScanWithoutOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOpenScanOnce T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpInScanTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpBeforeOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneScanPerTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n NoCloseTransaction T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityTimeOut T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityBeforeClose T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5021 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReaderror5022 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5023 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5024 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5025 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5030 T1
+
+max-time: 500
+cmd: testScan
+args: -n InsertDelete T1 T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadWhileNodeIsDown T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanRestart T1
+
+max-time: 500
+cmd: testScan
+args: -l 100 -n Scan-bug8262 T7
+
+max-time: 500
+cmd: testScan
+args: -n ScanParallelism
+
+#
+# DICT TESTS
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDrop
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropWithData
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropDuring T6 T10
+
+max-time: 1500
+cmd: testDict
+args: -n CreateInvalidTables
+
+max-time: 1500
+cmd: testDict
+args: -n CreateTableWhenDbIsFull T6
+
+max-time: 1500
+cmd: testDict
+args: -n CreateMaxTables T6
+
+max-time: 500
+cmd: testDict
+args: -n FragmentTypeSingle T1
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllSmall T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllLarge T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n TemporaryTables T1 T6 T7 T8
+
+#
+# TEST NDBAPI
+#
+max-time: 500
+cmd: testDataBuffers
+args:
+
+# Testsuite: testNdbApi
+# Number of tests: 5
+max-time: 500
+cmd: testNdbApi
+args: -n MaxNdb T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxTransactions T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxOperations T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxGetValue T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxEqual
+
+max-time: 500
+cmd: testNdbApi
+args: -n DeleteNdb T1 T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n WaitUntilReady T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetOperationNoTab T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n NdbErrorOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MissingOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetValueInUpdate T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutKeys T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutValues T6
+
+#max-time: 500
+#cmd: testInterpreter
+#args: T1
+#
+max-time: 150000
+cmd: testOperations
+args:
+
+max-time: 15000
+cmd: testTransactions
+args:
+
+max-time: 1500
+cmd: testRestartGci
+args: T6
+
+max-time: 600
+cmd: testBlobs
+args:
+
+max-time: 5000
+cmd: testOIBasic
+args:
+
+max-time: 2500
+cmd: testBitfield
+args:
+
+max-time: 2500
+cmd: testPartitioning
+args:
+
+#
+#
+# SYSTEM RESTARTS
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR1 T8
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR2 T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T7
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_UNDO T8
+
+# OLD FLEX
+max-time: 500
+cmd: flexBench
+args: -c 25 -t 10
+
+max-time: 500
+cmd: flexHammer
+args: -r 5 -t 32
+
+max-time: 300
+cmd: DbCreate
+args:
+
+max-time: 180
+cmd: DbAsyncGenerator
+args: -time 60 -p 1
+type: bench
+
+max-time: 180
+cmd: DbAsyncGenerator
+args: -time 60 -p 25
+type: bench
+
+max-time: 180
+cmd: DbAsyncGenerator
+args: -time 60 -p 100
+type: bench
+
+max-time: 180
+cmd: DbAsyncGenerator
+args: -time 60 -p 200
+type: bench
+
+max-time: 180
+cmd: DbAsyncGenerator
+args: -time 60 -p 1 -proc 25
+type: bench
+
diff --git a/storage/ndb/test/run-test/daily-devel-tests.txt b/storage/ndb/test/run-test/daily-devel-tests.txt
new file mode 100644
index 00000000000..20f54e031e5
--- /dev/null
+++ b/storage/ndb/test/run-test/daily-devel-tests.txt
@@ -0,0 +1,210 @@
+#
+# INDEX
+#
+max-time: 1500
+cmd: testIndex
+args: -n CreateAll T1 T6 T13
+
+#-m 7200 1: testIndex -n InsertDeleteGentle T7
+max-time: 3600
+cmd: testIndex
+args: -n InsertDelete T1 T10
+
+#-m 3600 1: testIndex -n CreateLoadDropGentle T7
+max-time: 3600
+cmd: testIndex
+args: -n CreateLoadDrop T1 T10
+
+#
+# BACKUP
+#
+max-time: 1000
+cmd: atrt-testBackup
+args: -n BackupBank T6
+
+#
+# MGMAPI AND MGSRV
+#
+max-time: 1800
+cmd: testMgm
+args: -n SingleUserMode T1
+
+#
+#
+# SYSTEM RESTARTS
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR3 T6
+
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR4 T6
+
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -n SR_FULLDB T6
+
+#
+# NODE RESTARTS
+#
+max-time: 2500
+cmd: testNodeRestart
+args: -n NoLoad T6
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n MixedPkRead T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -l 1 -n MixedPkReadPkUpdate
+
+max-time: 2500
+cmd: testNodeRestart
+args: -l 1 -n MixedReadUpdateScan
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n CommittedRead T1
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n LateCommit T1
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n Terror T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FullDb T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNode T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNodeError T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNodeInitial T6 T13
+
+max-time: 3600
+cmd: testNodeRestart
+args: -l 1 -n RestartNFDuringNR T6 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartMasterNodeError T6 T8 T13
+
+max-time: 3600
+cmd: testNodeRestart
+args: -n RestartNodeDuringLCP T6
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n TwoNodeFailure T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n TwoMasterNodeFailure T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FiftyPercentFail T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodes T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesAbort T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesError9999 T6 T8 T13
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n FiftyPercentStopAndWait T6 T8 T13
+
+#max-time: 500
+#cmd: testNodeRestart
+#args: -n StopOnError T1
+#
+#
+max-time: 2500
+cmd: testIndex
+args: -n NFNR1 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR2 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR3 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n BuildDuring T6
+
+max-time: 2500
+cmd: testIndex
+args: -l 2 -n SR1 T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR1_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR2_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n NFNR3_O T6 T13
+
+max-time: 2500
+cmd: testIndex
+args: -n BuildDuring_O T6
+
+max-time: 2500
+cmd: testIndex
+args: -l 2 -n SR1_O T6 T13
+
+max-time: 500
+cmd: testIndex
+args: -n MixedTransaction T1
+
+max-time: 2500
+cmd: testDict
+args: -n NF1 T1 T6 T13
+
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR6 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR7 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR8 T1
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR9 T1
+
+#
+max-time: 2500
+cmd: test_event
+args: -n EventOperationApplier
+
diff --git a/storage/ndb/test/run-test/example.conf b/storage/ndb/test/run-test/example.conf
new file mode 100644
index 00000000000..1e152da332d
--- /dev/null
+++ b/storage/ndb/test/run-test/example.conf
@@ -0,0 +1,10 @@
+target=pc-linux-i686
+base_dir=/ndb
+src_clone_base=mysqldev@bk-internal.mysql.com:/home/bk/mysql
+run_dir=/space/autotest
+build_dir=/ndb
+hosts="ndb01 ndb02 ndb03 ndb04 ndb05 ndb06 ndb07 ndb08 ndb09 ndb10 ndb11 ndb12"
+result_host="ndb.mysql.com"
+result_path="public_html"
+configure='CC=gcc CXX=gcc CFLAGS="-Wall -pedantic -Wno-long-long" CXXFLAGS="-Wall -pedantic -Wno-long-long" ./configure --with-ndbcluster --with-ndb-test --with-ndbcc-flags="-g -DERROR_INSERT"'
+
diff --git a/storage/ndb/test/run-test/main.cpp b/storage/ndb/test/run-test/main.cpp
new file mode 100644
index 00000000000..02c2cc862a3
--- /dev/null
+++ b/storage/ndb/test/run-test/main.cpp
@@ -0,0 +1,1004 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include <ndb_global.h>
+#include <getarg.h>
+#include <BaseString.hpp>
+#include <Parser.hpp>
+#include <NdbOut.hpp>
+#include <Properties.hpp>
+#include <NdbAutoPtr.hpp>
+
+#include "run-test.hpp"
+#include <SysLogHandler.hpp>
+#include <FileLogHandler.hpp>
+
+#include <mgmapi.h>
+#include "CpcClient.hpp"
+
+/** Global variables */
+static const char progname[] = "ndb_atrt";
+static const char * g_gather_progname = "atrt-gather-result.sh";
+static const char * g_analyze_progname = "atrt-analyze-result.sh";
+static const char * g_clear_progname = "atrt-clear-result.sh";
+static const char * g_setup_progname = "atrt-setup.sh";
+
+static const char * g_setup_path = 0;
+static const char * g_process_config_filename = "d.txt";
+static const char * g_log_filename = 0;
+static const char * g_test_case_filename = 0;
+static const char * g_report_filename = 0;
+
+static const char * g_default_user = 0;
+static const char * g_default_base_dir = 0;
+static int g_default_base_port = 0;
+static int g_mysqld_use_base = 1;
+
+static int g_report = 0;
+static int g_verbosity = 0;
+static FILE * g_report_file = 0;
+static FILE * g_test_case_file = stdin;
+
+Logger g_logger;
+atrt_config g_config;
+
+static int g_mode_bench = 0;
+static int g_mode_regression = 0;
+static int g_mode_interactive = 0;
+static int g_mode = 0;
+
+static
+struct getargs args[] = {
+ { "process-config", 0, arg_string, &g_process_config_filename, 0, 0 },
+ { "setup-path", 0, arg_string, &g_setup_path, 0, 0 },
+ { 0, 'v', arg_counter, &g_verbosity, 0, 0 },
+ { "log-file", 0, arg_string, &g_log_filename, 0, 0 },
+ { "testcase-file", 'f', arg_string, &g_test_case_filename, 0, 0 },
+ { 0, 'R', arg_flag, &g_report, 0, 0 },
+ { "report-file", 0, arg_string, &g_report_filename, 0, 0 },
+ { "interactive", 'i', arg_flag, &g_mode_interactive, 0, 0 },
+ { "regression", 'r', arg_flag, &g_mode_regression, 0, 0 },
+ { "bench", 'b', arg_flag, &g_mode_bench, 0, 0 },
+};
+
+const int arg_count = 10;
+
+int
+main(int argc, const char ** argv){
+ ndb_init();
+
+ bool restart = true;
+ int lineno = 1;
+ int test_no = 1;
+
+ const int p_ndb = atrt_process::NDB_MGM | atrt_process::NDB_DB;
+ const int p_servers = atrt_process::MYSQL_SERVER | atrt_process::NDB_REP;
+ const int p_clients = atrt_process::MYSQL_CLIENT | atrt_process::NDB_API;
+
+ g_logger.setCategory(progname);
+ g_logger.enable(Logger::LL_ALL);
+ g_logger.createConsoleHandler();
+
+ if(!parse_args(argc, argv))
+ goto end;
+
+ g_logger.info("Starting...");
+ if(!setup_config(g_config))
+ goto end;
+
+ g_logger.info("Connecting to hosts");
+ if(!connect_hosts(g_config))
+ goto end;
+
+ if(!setup_hosts(g_config))
+ goto end;
+
+ /**
+ * Main loop
+ */
+ while(!feof(g_test_case_file)){
+ /**
+ * Do we need to restart ndb
+ */
+ if(restart){
+ g_logger.info("(Re)starting ndb processes");
+ if(!stop_processes(g_config, atrt_process::NDB_MGM))
+ goto end;
+
+ if(!stop_processes(g_config, atrt_process::NDB_DB))
+ goto end;
+
+ if(!start_processes(g_config, atrt_process::NDB_MGM))
+ goto end;
+
+ if(!connect_ndb_mgm(g_config)){
+ goto end;
+ }
+
+ if(!start_processes(g_config, atrt_process::NDB_DB))
+ goto end;
+
+ if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NOT_STARTED))
+ goto end;
+
+ for(Uint32 i = 0; i<3; i++)
+ if(wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED))
+ goto started;
+
+ goto end;
+
+ started:
+ g_logger.info("Ndb start completed");
+ }
+
+ const int start_line = lineno;
+ atrt_testcase test_case;
+ if(!read_test_case(g_test_case_file, test_case, lineno))
+ goto end;
+
+ g_logger.info("#%d - %s %s",
+ test_no,
+ test_case.m_command.c_str(), test_case.m_args.c_str());
+
+ // Assign processes to programs
+ if(!setup_test_case(g_config, test_case))
+ goto end;
+
+ if(!start_processes(g_config, p_servers))
+ goto end;
+
+ if(!start_processes(g_config, p_clients))
+ goto end;
+
+ int result = 0;
+
+ const time_t start = time(0);
+ time_t now = start;
+ do {
+ if(!update_status(g_config, atrt_process::ALL))
+ goto end;
+
+ int count = 0;
+
+ if((count = is_running(g_config, p_ndb)) != 2){
+ result = ERR_NDB_FAILED;
+ break;
+ }
+
+ if((count = is_running(g_config, p_servers)) != 2){
+ result = ERR_SERVERS_FAILED;
+ break;
+ }
+
+ if((count = is_running(g_config, p_clients)) == 0){
+ break;
+ }
+
+ now = time(0);
+ if(now > (start + test_case.m_max_time)){
+ result = ERR_MAX_TIME_ELAPSED;
+ break;
+ }
+ sleep(1);
+ } while(true);
+
+ const time_t elapsed = time(0) - start;
+
+ if(!stop_processes(g_config, p_clients))
+ goto end;
+
+ if(!stop_processes(g_config, p_servers))
+ goto end;
+
+ if(!gather_result(g_config, &result))
+ goto end;
+
+ g_logger.info("#%d %s(%d)",
+ test_no,
+ (result == 0 ? "OK" : "FAILED"), result);
+
+ if(g_report_file != 0){
+ fprintf(g_report_file, "%s %s ; %d ; %d ; %ld\n",
+ test_case.m_command.c_str(),
+ test_case.m_args.c_str(),
+ test_no, result, elapsed);
+ fflush(g_report_file);
+ }
+
+ if(test_case.m_report || g_mode_bench || (g_mode_regression && result)){
+ BaseString tmp;
+ tmp.assfmt("result.%d", test_no);
+ if(rename("result", tmp.c_str()) != 0){
+ g_logger.critical("Failed to rename %s as %s",
+ "result", tmp.c_str());
+ goto end;
+ }
+ }
+
+ if(g_mode_interactive && result){
+ g_logger.info
+ ("Encountered failed test in interactive mode - terminating");
+ break;
+ }
+
+ if(result != 0){
+ restart = true;
+ } else {
+ restart = false;
+ }
+ test_no++;
+ }
+
+ end:
+ if(g_report_file != 0){
+ fclose(g_report_file);
+ g_report_file = 0;
+ }
+
+ if(g_test_case_file != 0 && g_test_case_file != stdin){
+ fclose(g_test_case_file);
+ g_test_case_file = 0;
+ }
+
+ stop_processes(g_config, atrt_process::ALL);
+ return 0;
+}
+
+bool
+parse_args(int argc, const char** argv){
+ int optind = 0;
+ if(getarg(args, arg_count, argc, argv, &optind)) {
+ arg_printusage(args, arg_count, progname, "");
+ return false;
+ }
+
+ if(g_log_filename != 0){
+ g_logger.removeConsoleHandler();
+ g_logger.addHandler(new FileLogHandler(g_log_filename));
+ }
+
+ {
+ int tmp = Logger::LL_WARNING - g_verbosity;
+ tmp = (tmp < Logger::LL_DEBUG ? Logger::LL_DEBUG : tmp);
+ g_logger.disable(Logger::LL_ALL);
+ g_logger.enable(Logger::LL_ON);
+ g_logger.enable((Logger::LoggerLevel)tmp, Logger::LL_ALERT);
+ }
+
+
+
+ if(!g_process_config_filename){
+ g_logger.critical("Process config not specified!");
+ return false;
+ }
+
+ if(!g_setup_path){
+ char buf[1024];
+ if(getcwd(buf, sizeof(buf))){
+ g_setup_path = strdup(buf);
+ g_logger.info("Setup path not specified, using %s", buf);
+ } else {
+ g_logger.critical("Setup path not specified!\n");
+ return false;
+ }
+ }
+
+ if(g_report & !g_report_filename){
+ g_report_filename = "report.txt";
+ }
+
+ if(g_report_filename){
+ g_report_file = fopen(g_report_filename, "w");
+ if(g_report_file == 0){
+ g_logger.critical("Unable to create report file: %s", g_report_filename);
+ return false;
+ }
+ }
+
+ if(g_test_case_filename){
+ g_test_case_file = fopen(g_test_case_filename, "r");
+ if(g_test_case_file == 0){
+ g_logger.critical("Unable to open file: %s", g_test_case_filename);
+ return false;
+ }
+ }
+
+ int sum = g_mode_interactive + g_mode_regression + g_mode_bench;
+ if(sum == 0){
+ g_mode_interactive = 1;
+ }
+
+ if(sum > 1){
+ g_logger.critical
+ ("Only one of bench/regression/interactive can be specified");
+ return false;
+ }
+
+ g_default_user = strdup(getenv("LOGNAME"));
+
+ return true;
+}
+
+
+static
+atrt_host *
+find(const BaseString& host, Vector<atrt_host> & hosts){
+ for(size_t i = 0; i<hosts.size(); i++){
+ if(hosts[i].m_hostname == host){
+ return &hosts[i];
+ }
+ }
+ return 0;
+}
+
+bool
+setup_config(atrt_config& config){
+
+ FILE * f = fopen(g_process_config_filename, "r");
+ if(!f){
+ g_logger.critical("Failed to open process config file: %s",
+ g_process_config_filename);
+ return false;
+ }
+ bool result = true;
+
+ int lineno = 0;
+ char buf[2048];
+ BaseString connect_string;
+ int mysql_port_offset = 0;
+ while(fgets(buf, 2048, f)){
+ lineno++;
+
+ BaseString tmp(buf);
+ tmp.trim(" \t\n\r");
+
+ if(tmp.length() == 0 || tmp == "" || tmp.c_str()[0] == '#')
+ continue;
+
+ Vector<BaseString> split1;
+ if(tmp.split(split1, ":", 2) != 2){
+ g_logger.warning("Invalid line %d in %s - ignoring",
+ lineno, g_process_config_filename);
+ continue;
+ }
+
+ if(split1[0].trim() == "basedir"){
+ g_default_base_dir = strdup(split1[1].trim().c_str());
+ continue;
+ }
+
+ if(split1[0].trim() == "baseport"){
+ g_default_base_port = atoi(split1[1].trim().c_str());
+ continue;
+ }
+
+ if(split1[0].trim() == "user"){
+ g_default_user = strdup(split1[1].trim().c_str());
+ continue;
+ }
+
+ if(split1[0].trim() == "mysqld-use-base" && split1[1].trim() == "no"){
+ g_mysqld_use_base = 0;
+ continue;
+ }
+
+ Vector<BaseString> hosts;
+ if(split1[1].trim().split(hosts) <= 0){
+ g_logger.warning("Invalid line %d in %s - ignoring",
+ lineno, g_process_config_filename);
+ }
+
+ // 1 - Check hosts
+ for(size_t i = 0; i<hosts.size(); i++){
+ Vector<BaseString> tmp;
+ hosts[i].split(tmp, ":");
+ BaseString hostname = tmp[0].trim();
+ BaseString base_dir;
+ if(tmp.size() >= 2)
+ base_dir = tmp[1];
+ else if(g_default_base_dir == 0){
+ g_logger.critical("Basedir not specified...");
+ return false;
+ }
+
+ atrt_host * host_ptr;
+ if((host_ptr = find(hostname, config.m_hosts)) == 0){
+ atrt_host host;
+ host.m_index = config.m_hosts.size();
+ host.m_cpcd = new SimpleCpcClient(hostname.c_str(), 1234);
+ host.m_base_dir = (base_dir.empty() ? g_default_base_dir : base_dir);
+ host.m_user = g_default_user;
+ host.m_hostname = hostname.c_str();
+ config.m_hosts.push_back(host);
+ } else {
+ if(!base_dir.empty() && (base_dir == host_ptr->m_base_dir)){
+ g_logger.critical("Inconsistent base dir definition for host %s"
+ ", \"%s\" != \"%s\"", hostname.c_str(),
+ base_dir.c_str(), host_ptr->m_base_dir.c_str());
+ return false;
+ }
+ }
+ }
+
+ for(size_t i = 0; i<hosts.size(); i++){
+ BaseString & tmp = hosts[i];
+ atrt_host * host = find(tmp, config.m_hosts);
+ BaseString & dir = host->m_base_dir;
+
+ const int index = config.m_processes.size() + 1;
+
+ atrt_process proc;
+ proc.m_index = index;
+ proc.m_host = host;
+ proc.m_proc.m_id = -1;
+ proc.m_proc.m_type = "temporary";
+ proc.m_proc.m_owner = "atrt";
+ proc.m_proc.m_group = "group";
+ proc.m_proc.m_cwd.assign(dir).append("/run/");
+ proc.m_proc.m_stdout = "log.out";
+ proc.m_proc.m_stderr = "2>&1";
+ proc.m_proc.m_runas = proc.m_host->m_user;
+ proc.m_proc.m_ulimit = "c:unlimited";
+ proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir.c_str());
+ proc.m_hostname = proc.m_host->m_hostname;
+ proc.m_ndb_mgm_port = g_default_base_port;
+ if(split1[0] == "mgm"){
+ proc.m_type = atrt_process::NDB_MGM;
+ proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd");
+ proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd");
+ proc.m_proc.m_args = "--nodaemon -f config.ini";
+ proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index);
+ connect_string.appfmt("host=%s:%d;",
+ proc.m_hostname.c_str(), proc.m_ndb_mgm_port);
+ } else if(split1[0] == "ndb"){
+ proc.m_type = atrt_process::NDB_DB;
+ proc.m_proc.m_name.assfmt("%d-%s", index, "ndbd");
+ proc.m_proc.m_path.assign(dir).append("/libexec/ndbd");
+ proc.m_proc.m_args = "--initial --nodaemon -n";
+ proc.m_proc.m_cwd.appfmt("%d.ndbd", index);
+ } else if(split1[0] == "mysqld"){
+ proc.m_type = atrt_process::MYSQL_SERVER;
+ proc.m_proc.m_name.assfmt("%d-%s", index, "mysqld");
+ proc.m_proc.m_path.assign(dir).append("/libexec/mysqld");
+ proc.m_proc.m_args = "--core-file --ndbcluster";
+ proc.m_proc.m_cwd.appfmt("%d.mysqld", index);
+ if(mysql_port_offset > 0 || g_mysqld_use_base){
+ // setup mysql specific stuff
+ const char * basedir = proc.m_proc.m_cwd.c_str();
+ proc.m_proc.m_args.appfmt("--datadir=%s", basedir);
+ proc.m_proc.m_args.appfmt("--pid-file=%s/mysql.pid", basedir);
+ proc.m_proc.m_args.appfmt("--socket=%s/mysql.sock", basedir);
+ proc.m_proc.m_args.appfmt("--port=%d",
+ g_default_base_port-(++mysql_port_offset));
+ }
+ } else if(split1[0] == "api"){
+ proc.m_type = atrt_process::NDB_API;
+ proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api");
+ proc.m_proc.m_path = "";
+ proc.m_proc.m_args = "";
+ proc.m_proc.m_cwd.appfmt("%d.ndb_api", index);
+ } else {
+ g_logger.critical("%s:%d: Unhandled process type: %s",
+ g_process_config_filename, lineno,
+ split1[0].c_str());
+ result = false;
+ goto end;
+ }
+ config.m_processes.push_back(proc);
+ }
+ }
+
+ // Setup connect string
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ config.m_processes[i].m_proc.m_env.appfmt(" NDB_CONNECTSTRING=%s",
+ connect_string.c_str());
+ }
+
+ end:
+ fclose(f);
+ return result;
+}
+
+bool
+connect_hosts(atrt_config& config){
+ for(size_t i = 0; i<config.m_hosts.size(); i++){
+ if(config.m_hosts[i].m_cpcd->connect() != 0){
+ g_logger.error("Unable to connect to cpc %s:%d",
+ config.m_hosts[i].m_cpcd->getHost(),
+ config.m_hosts[i].m_cpcd->getPort());
+ return false;
+ }
+ g_logger.debug("Connected to %s:%d",
+ config.m_hosts[i].m_cpcd->getHost(),
+ config.m_hosts[i].m_cpcd->getPort());
+ }
+
+ return true;
+}
+
+bool
+connect_ndb_mgm(atrt_process & proc){
+ NdbMgmHandle handle = ndb_mgm_create_handle();
+ if(handle == 0){
+ g_logger.critical("Unable to create mgm handle");
+ return false;
+ }
+ BaseString tmp = proc.m_hostname;
+ tmp.appfmt(":%d", proc.m_ndb_mgm_port);
+
+ if (ndb_mgm_set_connectstring(handle,tmp.c_str()))
+ {
+ g_logger.critical("Unable to create parse connectstring");
+ return false;
+ }
+
+ if(ndb_mgm_connect(handle, 30, 1, 0) != -1)
+ {
+ proc.m_ndb_mgm_handle = handle;
+ return true;
+ }
+
+ g_logger.critical("Unable to connect to ndb mgm %s", tmp.c_str());
+ return false;
+}
+
+bool
+connect_ndb_mgm(atrt_config& config){
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if((proc.m_type & atrt_process::NDB_MGM) != 0){
+ if(!connect_ndb_mgm(proc)){
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+static int remap(int i){
+ if(i == NDB_MGM_NODE_STATUS_NO_CONTACT) return NDB_MGM_NODE_STATUS_UNKNOWN;
+ if(i == NDB_MGM_NODE_STATUS_UNKNOWN) return NDB_MGM_NODE_STATUS_NO_CONTACT;
+ return i;
+}
+
+bool
+wait_ndb(atrt_config& config, int goal){
+
+ goal = remap(goal);
+
+
+ /**
+ * Get mgm handle for cluster
+ */
+ NdbMgmHandle handle = 0;
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if((proc.m_type & atrt_process::NDB_MGM) != 0){
+ handle = proc.m_ndb_mgm_handle;
+ break;
+ }
+ }
+ if(handle == 0){
+ g_logger.critical("Unable to find mgm handle");
+ return false;
+ }
+
+ if(goal == NDB_MGM_NODE_STATUS_STARTED){
+ /**
+ * 1) wait NOT_STARTED
+ * 2) send start
+ * 3) wait STARTED
+ */
+ if(!wait_ndb(config, NDB_MGM_NODE_STATUS_NOT_STARTED))
+ return false;
+
+ ndb_mgm_start(handle, 0, 0);
+ }
+
+ struct ndb_mgm_cluster_state * state;
+
+ time_t now = time(0);
+ time_t end = now + 360;
+ int min = remap(NDB_MGM_NODE_STATUS_NO_CONTACT);
+ int min2 = goal;
+
+ while(now < end){
+ /**
+ * 1) retreive current state
+ */
+ state = 0;
+ do {
+ state = ndb_mgm_get_status(handle);
+ if(state == 0){
+ const int err = ndb_mgm_get_latest_error(handle);
+ g_logger.error("Unable to poll db state: %d %s %s",
+ ndb_mgm_get_latest_error(handle),
+ ndb_mgm_get_latest_error_msg(handle),
+ ndb_mgm_get_latest_error_desc(handle));
+ if(err == NDB_MGM_SERVER_NOT_CONNECTED && connect_ndb_mgm(config)){
+ g_logger.error("Reconnected...");
+ continue;
+ }
+ return false;
+ }
+ } while(state == 0);
+ NdbAutoPtr<void> tmp(state);
+
+ min2 = goal;
+ for(int i = 0; i<state->no_of_nodes; i++){
+ if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB){
+ const int s = remap(state->node_states[i].node_status);
+ min2 = (min2 < s ? min2 : s );
+
+ if(s < remap(NDB_MGM_NODE_STATUS_NO_CONTACT) ||
+ s > NDB_MGM_NODE_STATUS_STARTED){
+ g_logger.critical("Strange DB status during start: %d %d", i, min2);
+ return false;
+ }
+
+ if(min2 < min){
+ g_logger.critical("wait ndb failed node: %d %d %d %d",
+ state->node_states[i].node_id, min, min2, goal);
+ }
+ }
+ }
+
+ if(min2 < min){
+ g_logger.critical("wait ndb failed %d %d %d", min, min2, goal);
+ return false;
+ }
+
+ if(min2 == goal){
+ return true;
+ break;
+ }
+
+ min = min2;
+ now = time(0);
+ }
+
+ g_logger.critical("wait ndb timed out %d %d %d", min, min2, goal);
+
+ return false;
+}
+
+bool
+start_process(atrt_process & proc){
+ if(proc.m_proc.m_id != -1){
+ g_logger.critical("starting already started process: %d", proc.m_index);
+ return false;
+ }
+
+ BaseString path = proc.m_proc.m_cwd.substr(proc.m_host->m_base_dir.length()+BaseString("/run").length());
+
+ BaseString tmp = g_setup_progname;
+ tmp.appfmt(" %s %s/%s/ %s",
+ proc.m_host->m_hostname.c_str(),
+ g_setup_path,
+ path.c_str(),
+ proc.m_proc.m_cwd.c_str());
+
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0){
+ g_logger.critical("Failed to setup process");
+ return false;
+ }
+
+ {
+ Properties reply;
+ if(proc.m_host->m_cpcd->define_process(proc.m_proc, reply) != 0){
+ BaseString msg;
+ reply.get("errormessage", msg);
+ g_logger.error("Unable to define process: %s", msg.c_str());
+ return false;
+ }
+ }
+ {
+ Properties reply;
+ if(proc.m_host->m_cpcd->start_process(proc.m_proc.m_id, reply) != 0){
+ BaseString msg;
+ reply.get("errormessage", msg);
+ g_logger.error("Unable to start process: %s", msg.c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+bool
+start_processes(atrt_config& config, int types){
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if((types & proc.m_type) != 0 && proc.m_proc.m_path != ""){
+ if(!start_process(proc)){
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool
+stop_process(atrt_process & proc){
+ if(proc.m_proc.m_id == -1){
+ return true;
+ }
+
+ {
+ Properties reply;
+ if(proc.m_host->m_cpcd->stop_process(proc.m_proc.m_id, reply) != 0){
+ Uint32 status;
+ reply.get("status", &status);
+ if(status != 4){
+ BaseString msg;
+ reply.get("errormessage", msg);
+ g_logger.error("Unable to stop process: %s(%d)", msg.c_str(), status);
+ return false;
+ }
+ }
+ }
+ {
+ Properties reply;
+ if(proc.m_host->m_cpcd->undefine_process(proc.m_proc.m_id, reply) != 0){
+ BaseString msg;
+ reply.get("errormessage", msg);
+ g_logger.error("Unable to undefine process: %s", msg.c_str());
+ return false;
+ }
+ proc.m_proc.m_id = -1;
+ }
+ return true;
+}
+
+bool
+stop_processes(atrt_config& config, int types){
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if((types & proc.m_type) != 0){
+ if(!stop_process(proc)){
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool
+update_status(atrt_config& config, int){
+
+ Vector<Vector<SimpleCpcClient::Process> > m_procs;
+
+ Vector<SimpleCpcClient::Process> dummy;
+ m_procs.fill(config.m_hosts.size(), dummy);
+ for(size_t i = 0; i<config.m_hosts.size(); i++){
+ Properties p;
+ config.m_hosts[i].m_cpcd->list_processes(m_procs[i], p);
+ }
+
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if(proc.m_proc.m_id != -1){
+ Vector<SimpleCpcClient::Process> &h_procs= m_procs[proc.m_host->m_index];
+ bool found = false;
+ for(size_t j = 0; j<h_procs.size(); j++){
+ if(proc.m_proc.m_id == h_procs[j].m_id){
+ found = true;
+ proc.m_proc.m_status = h_procs[j].m_status;
+ break;
+ }
+ }
+ if(!found){
+ g_logger.error("update_status: not found");
+ g_logger.error("id: %d host: %s cmd: %s",
+ proc.m_proc.m_id,
+ proc.m_hostname.c_str(),
+ proc.m_proc.m_path.c_str());
+ for(size_t j = 0; j<h_procs.size(); j++){
+ g_logger.error("found: %d %s", h_procs[j].m_id,
+ h_procs[j].m_path.c_str());
+ }
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+int
+is_running(atrt_config& config, int types){
+ int found = 0, running = 0;
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if((types & proc.m_type) != 0){
+ found++;
+ if(proc.m_proc.m_status == "running")
+ running++;
+ }
+ }
+
+ if(found == running)
+ return 2;
+ if(running == 0)
+ return 0;
+ return 1;
+}
+
+
+int
+insert(const char * pair, Properties & p){
+ BaseString tmp(pair);
+
+ tmp.trim(" \t\n\r");
+
+ Vector<BaseString> split;
+ tmp.split(split, ":=", 2);
+
+ if(split.size() != 2)
+ return -1;
+
+ p.put(split[0].trim().c_str(), split[1].trim().c_str());
+
+ return 0;
+}
+
+bool
+read_test_case(FILE * file, atrt_testcase& tc, int& line){
+
+ Properties p;
+ int elements = 0;
+ char buf[1024];
+ while(!feof(file)){
+ if(!fgets(buf, 1024, file))
+ break;
+
+ line++;
+ BaseString tmp = buf;
+
+ if(tmp.length() > 0 && tmp.c_str()[0] == '#')
+ continue;
+
+ if(insert(tmp.c_str(), p) != 0)
+ break;
+
+ elements++;
+ }
+
+ if(elements == 0){
+ if(file == stdin){
+ BaseString tmp(buf);
+ tmp.trim(" \t\n\r");
+ Vector<BaseString> split;
+ tmp.split(split, " ", 2);
+ tc.m_command = split[0];
+ if(split.size() == 2)
+ tc.m_args = split[1];
+ else
+ tc.m_args = "";
+ tc.m_max_time = 60000;
+ return true;
+ }
+ return false;
+ }
+
+ if(!p.get("cmd", tc.m_command)){
+ g_logger.critical("Invalid test file: cmd is missing near line: %d", line);
+ return false;
+ }
+
+ if(!p.get("args", tc.m_args))
+ tc.m_args = "";
+
+ const char * mt = 0;
+ if(!p.get("max-time", &mt))
+ tc.m_max_time = 60000;
+ else
+ tc.m_max_time = atoi(mt);
+
+ if(p.get("type", &mt) && strcmp(mt, "bench") == 0)
+ tc.m_report= true;
+ else
+ tc.m_report= false;
+
+ return true;
+}
+
+bool
+setup_test_case(atrt_config& config, const atrt_testcase& tc){
+ const int r1 = system(g_clear_progname);
+ if(r1 != 0){
+ g_logger.critical("Failed to clear result");
+ return false;
+ }
+
+ size_t i = 0;
+ for(; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if(proc.m_type == atrt_process::NDB_API){
+ proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_base_dir.c_str(),
+ tc.m_command.c_str());
+ proc.m_proc.m_args.assign(tc.m_args);
+ break;
+ }
+ }
+ for(i++; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if(proc.m_type == atrt_process::NDB_API){
+ proc.m_proc.m_path.assign("");
+ proc.m_proc.m_args.assign("");
+ }
+ }
+ return true;
+}
+
+bool
+gather_result(atrt_config& config, int * result){
+ BaseString tmp = g_gather_progname;
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if(proc.m_proc.m_path != ""){
+ tmp.appfmt(" %s:%s",
+ proc.m_hostname.c_str(),
+ proc.m_proc.m_cwd.c_str());
+ }
+ }
+
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0){
+ g_logger.critical("Failed to gather result");
+ return false;
+ }
+
+ const int r2 = system(g_analyze_progname);
+
+ if(r2 == -1 || r2 == (127 << 8)){
+ g_logger.critical("Failed to analyze results");
+ return false;
+ }
+
+ * result = r2 ;
+ return true;
+}
+
+bool
+setup_hosts(atrt_config& config){
+ const int r1 = system(g_clear_progname);
+ if(r1 != 0){
+ g_logger.critical("Failed to clear result");
+ return false;
+ }
+
+ for(size_t i = 0; i<config.m_hosts.size(); i++){
+ BaseString tmp = g_setup_progname;
+ tmp.appfmt(" %s %s/ %s/run",
+ config.m_hosts[i].m_hostname.c_str(),
+ g_setup_path,
+ config.m_hosts[i].m_base_dir.c_str());
+
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0){
+ g_logger.critical("Failed to setup %s",
+ config.m_hosts[i].m_hostname.c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+template class Vector<Vector<SimpleCpcClient::Process> >;
+template class Vector<atrt_host>;
+template class Vector<atrt_process>;
diff --git a/storage/ndb/test/run-test/make-config.sh b/storage/ndb/test/run-test/make-config.sh
new file mode 100755
index 00000000000..5394b0654d4
--- /dev/null
+++ b/storage/ndb/test/run-test/make-config.sh
@@ -0,0 +1,465 @@
+#!/bin/sh
+# NAME
+# make-config.sh - Makes a config file for mgm server
+#
+# SYNOPSIS
+# make-config.sh [ -t <template> ] [-s] [ -m <machine conf> [ -d <directory> ]
+#
+# DESCRIPTION
+#
+# OPTIONS
+#
+# EXAMPLES
+#
+#
+# ENVIRONMENT
+# NDB_PROJ_HOME Home dir for ndb
+#
+# FILES
+# $NDB_PROJ_HOME/lib/funcs.sh general shell script functions
+#
+#
+# SEE ALSO
+#
+# DIAGNOSTICTS
+#
+# VERSION
+# 1.0
+# 1.1 021112 epesson: Adapted for new mgmt server in NDB 2.00
+#
+# AUTHOR
+# Jonas Oreland
+#
+# CHANGES
+# also generate ndbnet config
+#
+
+progname=`basename $0`
+synopsis="make-config.sh [ -t template ] [ -m <machine conf> ] [ -d <dst directory> ][-s] [<mgm host>]"
+
+#: ${NDB_PROJ_HOME:?} # If undefined, exit with error message
+
+#: ${NDB_LOCAL_BUILD_OPTIONS:=--} # If undef, set to --. Keeps getopts happy.
+ # You may have to experiment a bit
+ # to get quoting right (if you need it).
+
+
+#. $NDB_PROJ_HOME/lib/funcs.sh # Load some good stuff
+trace() {
+ echo $* 1>&2
+}
+syndie() {
+ trace $*
+ exit 1
+}
+
+# defaults for options related variables
+#
+
+mgm_nodes=0
+ndb_nodes=0
+api_nodes=0
+uniq_id=$$.$$
+own_host=`hostname`
+dst_dir=""
+template=/dev/null
+machines=/dev/null
+verbose=yes
+
+# used if error when parsing the options environment variable
+#
+env_opterr="options environment variable: <<$options>>"
+
+# Option parsing, for the options variable as well as the command line.
+#
+# We want to be able to set options in an environment variable,
+# as well as on the command line. In order not to have to repeat
+# the same getopts information twice, we loop two times over the
+# getopts while loop. The first time, we process options from
+# the options environment variable, the second time we process
+# options from the command line.
+#
+# The things to change are the actual options and what they do.
+#
+add_node(){
+ no=$1; shift
+ type=$1; shift
+ echo $* | awk 'BEGIN{FS=":";}{h=$1; if(h=="localhost") h="'$own_host'";
+ printf("%s_%d_host=%s\n", "'$type'", "'$no'", h);
+ if(NF>1 && $2!="") printf("%s_%d_port=%d\n",
+ "'$type'", "'$no'", $2);
+ if(NF>2 && $3!="") printf("%s_%d_dir=%s\n",
+ "'$type'", "'$no'", $3);
+ }'
+}
+
+
+add_mgm_node(){
+ mgm_nodes=`cat /tmp/mgm_nodes.$uniq_id | grep "_host=" | wc -l`
+ mgm_nodes=`expr $mgm_nodes + 1`
+ while [ $# -gt 0 ]
+ do
+ add_node ${mgm_nodes} mgm_node $1 >> /tmp/mgm_nodes.$uniq_id
+ shift
+ mgm_nodes=`expr $mgm_nodes + 1`
+ done
+}
+
+add_ndb_node(){
+ ndb_nodes=`cat /tmp/ndb_nodes.$uniq_id | grep "_host=" | wc -l`
+ ndb_nodes=`expr $ndb_nodes + 1`
+ while [ $# -gt 0 ]
+ do
+ add_node ${ndb_nodes} ndb_node $1 >> /tmp/ndb_nodes.$uniq_id
+ shift
+ ndb_nodes=`expr $ndb_nodes + 1`
+ done
+}
+
+add_api_node(){
+ api_nodes=`cat /tmp/api_nodes.$uniq_id | grep "_host=" |wc -l`
+ api_nodes=`expr $api_nodes + 1`
+ while [ $# -gt 0 ]
+ do
+ add_node ${api_nodes} api_node $1 >> /tmp/api_nodes.$uniq_id
+ shift
+ api_nodes=`expr $api_nodes + 1`
+ done
+}
+
+rm -rf /tmp/mgm_nodes.$uniq_id ; touch /tmp/mgm_nodes.$uniq_id
+rm -rf /tmp/ndb_nodes.$uniq_id ; touch /tmp/ndb_nodes.$uniq_id
+rm -rf /tmp/api_nodes.$uniq_id ; touch /tmp/api_nodes.$uniq_id
+
+for optstring in "$options" "" # 1. options variable 2. cmd line
+do
+
+ while getopts d:m:t:n:o:a:b:p:s i $optstring # optstring empty => no arg => cmd line
+ do
+ case $i in
+
+ q) verbose="";; # echo important things
+ t) template=$OPTARG;; # Template
+ d) dst_dir=$OPTARG;; # Destination directory
+ m) machines=$OPTARG;; # Machine configuration
+ s) mgm_start=yes;; # Make mgm start script
+ \?) syndie $env_opterr;; # print synopsis and exit
+
+ esac
+ done
+
+ [ -n "$optstring" ] && OPTIND=1 # Reset for round 2, cmdline options
+
+ env_opterr= # Round 2 should not use the value
+
+done
+shift `expr $OPTIND - 1`
+
+if [ -z "$dst_dir" ]
+then
+ verbose=
+fi
+
+skip(){
+ no=$1; shift
+ shift $no
+ echo $*
+}
+
+# --- option parsing done ---
+grep "^ndb: " $machines | while read node
+do
+ node=`skip 1 $node`
+ add_ndb_node $node
+done
+
+grep "^api: " $machines | while read node
+do
+ node=`skip 1 $node`
+ add_api_node $node
+done
+
+grep "^mgm: " $machines | while read node
+do
+ node=`skip 1 $node`
+ add_mgm_node $node
+done
+
+tmp=`grep "^baseport: " $machines | tail -1 | cut -d ":" -f 2`
+if [ "$tmp" ]
+then
+ baseport=`echo $tmp`
+else
+ syndie "Unable to find baseport"
+fi
+
+trim(){
+ echo $*
+}
+tmp=`grep "^basedir: " $machines | tail -1 | cut -d ":" -f 2`
+if [ "$tmp" ]
+then
+ basedir=`trim $tmp`
+fi
+
+# -- Load enviroment --
+ndb_nodes=`cat /tmp/ndb_nodes.$uniq_id | grep "_host=" | wc -l`
+api_nodes=`cat /tmp/api_nodes.$uniq_id | grep "_host=" | wc -l`
+mgm_nodes=`cat /tmp/mgm_nodes.$uniq_id | grep "_host=" | wc -l`
+. /tmp/ndb_nodes.$uniq_id
+. /tmp/api_nodes.$uniq_id
+. /tmp/mgm_nodes.$uniq_id
+rm -f /tmp/ndb_nodes.$uniq_id /tmp/api_nodes.$uniq_id /tmp/mgm_nodes.$uniq_id
+
+# -- Verify
+trace "Verifying arguments"
+
+if [ ! -r $template ]
+then
+ syndie "Unable to read template file: $template"
+fi
+
+if [ $ndb_nodes -le 0 ]
+then
+ syndie "No ndb nodes specified"
+fi
+
+if [ $api_nodes -le 0 ]
+then
+ syndie "No api nodes specified"
+fi
+
+if [ $mgm_nodes -gt 1 ]
+then
+ syndie "More than one mgm node specified"
+fi
+
+if [ $mgm_nodes -eq 0 ]
+then
+ trace "No managment server specified using `hostname`"
+ mgm_nodes=1
+ mgm_node_1=`hostname`
+fi
+
+if [ -n "$dst_dir" ]
+then
+ mkdir -p $dst_dir
+ if [ ! -d $dst_dir ]
+ then
+ syndie "Unable to create dst dir: $dst_dir"
+ fi
+ DST=/tmp/$uniq_id
+fi
+
+# --- option verifying done ---
+
+# Find uniq computers
+i=1
+while [ $i -le $mgm_nodes ]
+do
+ echo `eval echo "\$"mgm_node_${i}_host` >> /tmp/hosts.$uniq_id
+ i=`expr $i + 1`
+done
+
+i=1
+while [ $i -le $ndb_nodes ]
+do
+ echo `eval echo "\$"ndb_node_${i}_host` >> /tmp/hosts.$uniq_id
+ i=`expr $i + 1`
+done
+
+i=1
+while [ $i -le $api_nodes ]
+do
+ echo `eval echo "\$"api_node_${i}_host` >> /tmp/hosts.$uniq_id
+ i=`expr $i + 1`
+done
+
+sort -u -o /tmp/hosts.$uniq_id /tmp/hosts.$uniq_id
+
+get_computer_id(){
+ grep -w -n $1 /tmp/hosts.$uniq_id | cut -d ":" -f 1
+}
+
+get_mgm_computer_id(){
+ a=`eval echo "\$"mgm_node_${1}_host`
+ get_computer_id $a
+}
+
+get_ndb_computer_id(){
+ a=`eval echo "\$"ndb_node_${1}_host`
+ get_computer_id $a
+}
+
+get_api_computer_id(){
+ a=`eval echo "\$"api_node_${1}_host`
+ get_computer_id $a
+}
+
+# -- Write config files --
+
+mgm_port=$baseport
+
+(
+ i=1
+ #echo "COMPUTERS"
+ cat /tmp/hosts.$uniq_id | while read host
+ do
+ echo "[COMPUTER]"
+ echo "Id: $i"
+ echo "ByteOrder: Big"
+ echo "HostName: $host"
+ echo
+ i=`expr $i + 1`
+ done
+
+ node_id=1
+ echo
+
+ # Mgm process
+ echo
+ echo "[MGM]"
+ echo "Id: $node_id"
+ echo "ExecuteOnComputer: `get_mgm_computer_id 1`"
+ echo "PortNumber: $mgm_port"
+ node_id=`expr $node_id + 1`
+
+ # Ndb processes
+ i=1
+ ndb_nodes=`trim $ndb_nodes`
+ while [ $i -le $ndb_nodes ]
+ do
+ echo
+ echo "[DB]"
+ echo "Id: $node_id"
+ echo "ExecuteOnComputer: `get_ndb_computer_id $i`"
+ echo "FileSystemPath: $basedir/run/node-${node_id}-fs"
+ i=`expr $i + 1`
+ node_id=`expr $node_id + 1`
+ done
+
+ # API processes
+ i=1
+ while [ $i -le $api_nodes ]
+ do
+ echo
+ echo "[API]"
+ echo "Id: $node_id"
+ echo "ExecuteOnComputer: `get_api_computer_id $i`"
+ i=`expr $i + 1`
+ node_id=`expr $node_id + 1`
+ done
+
+ # Connections
+ current_port=`expr $mgm_port + 1`
+ echo
+
+ # Connect Mgm with all ndb-nodes
+ i=1
+ while [ $i -le $ndb_nodes ]
+ do
+ echo
+ echo "[TCP]"
+ echo "NodeId1: 1"
+ echo "NodeId2: `expr $i + 1`"
+ echo "PortNumber: $current_port"
+ i=`expr $i + 1`
+ current_port=`expr $current_port + 1`
+ done
+
+ # Connect All ndb processes with all ndb processes
+ i=1
+ while [ $i -le $ndb_nodes ]
+ do
+ j=`expr $i + 1`
+ while [ $j -le $ndb_nodes ]
+ do
+ echo
+ echo "[TCP]"
+ echo "NodeId1: `expr $i + 1`"
+ echo "NodeId2: `expr $j + 1`"
+ echo "PortNumber: $current_port"
+ j=`expr $j + 1`
+ current_port=`expr $current_port + 1`
+ done
+ i=`expr $i + 1`
+ done
+
+ # Connect all ndb-nodes with all api nodes
+ i=1
+ while [ $i -le $ndb_nodes ]
+ do
+ j=1
+ while [ $j -le $api_nodes ]
+ do
+ echo
+ echo "[TCP]"
+ echo "NodeId1: `expr $i + 1`"
+ echo "NodeId2: `expr $j + $ndb_nodes + 1`"
+ echo "PortNumber: $current_port"
+ j=`expr $j + 1`
+ current_port=`expr $current_port + 1`
+ done
+ i=`expr $i + 1`
+ done
+ echo
+) > $DST
+
+trace "Init config file done"
+
+if [ -z "$dst_dir" ]
+then
+ cat $DST
+ rm -f $DST
+ rm -f /tmp/hosts.$uniq_id
+ exit 0
+fi
+
+###
+# Create Ndb.cfg files
+
+# nodeid=2;host=localhost:2200
+
+# Mgm node
+mkcfg(){
+ mkdir -p $dst_dir/${2}.ndb_${1}
+ (
+ echo "OwnProcessId $2"
+ echo "host://${mgm_node_1_host}:${mgm_port}"
+ ) > $dst_dir/${2}.ndb_${1}/Ndb.cfg
+ if [ $1 = "db" ]
+ then
+ mkdir $dst_dir/node-${2}-fs
+ fi
+}
+
+mkcfg mgm 1
+cat $DST > $dst_dir/1.ndb_mgm/initconfig.txt
+
+trace "Creating Ndb.cfg for ndb nodes"
+
+current_node=2
+i=1
+while [ $i -le $ndb_nodes ]
+do
+ mkcfg db ${current_node}
+ i=`expr $i + 1`
+ current_node=`expr $current_node + 1`
+done
+
+trace "Creating Ndb.cfg for api nodes"
+
+i=1
+while [ $i -le $api_nodes ]
+do
+ mkcfg api ${current_node}
+ i=`expr $i + 1`
+ current_node=`expr $current_node + 1`
+done
+
+rm -f $DST
+rm -f /tmp/hosts.$uniq_id
+
+
+exit 0
+# vim: set sw=4:
diff --git a/storage/ndb/test/run-test/make-html-reports.sh b/storage/ndb/test/run-test/make-html-reports.sh
new file mode 100755
index 00000000000..67395ceba47
--- /dev/null
+++ b/storage/ndb/test/run-test/make-html-reports.sh
@@ -0,0 +1,192 @@
+#!/bin/sh
+
+src_dir=$1
+run=$2
+date=$3
+src_file=$src_dir/report.txt
+
+if [ ! -f $src_dir/report.txt ]
+then
+ echo "$src_dir/report.txt is missing"
+ exit 1
+fi
+
+###
+#
+# General html functions
+trim(){
+ echo $*
+}
+
+header(){
+ cat <<EOF
+<html><head><title>$*</title></head>
+<body>
+EOF
+}
+
+footer(){
+ cat <<EOF
+</body></html>
+EOF
+}
+
+heading(){
+ h=$1; shift
+ cat <<EOF
+<h$h>$*</h$h>
+EOF
+}
+
+table(){
+ echo "<table $*>"
+}
+
+end_table(){
+ echo "</table>"
+}
+
+row(){
+ echo "<tr>"
+}
+
+end_row(){
+ echo "</tr>"
+}
+
+c_column(){
+ cat <<EOF
+<td valign=center align=center>$*</td>
+EOF
+}
+
+bold(){
+ cat <<EOF
+<b>$*</b>
+EOF
+}
+column(){
+ cat <<EOF
+<td valign=center align=left>$*</td>
+EOF
+}
+
+para(){
+ cat <<EOF
+<p></p>
+EOF
+}
+
+hr(){
+ cat <<EOF
+<hr>
+EOF
+}
+
+# -- Verify
+time_spec(){
+ # $1 - secs
+ _ts_tmp=$1
+
+ _ts_s=`expr $_ts_tmp % 60`
+ _ts_tmp=`expr $_ts_tmp / 60`
+
+ _ts_m=`expr $_ts_tmp % 60`
+ if [ $_ts_tmp -ge 60 ]
+ then
+ _ts_tmp=`expr $_ts_tmp / 60`
+ else
+ _ts_tmp=0
+ fi
+
+ a=3
+ _ts_h=$_ts_tmp
+
+ if [ $_ts_h -gt 0 ]
+ then
+ ret="${_ts_h}h"
+ fi
+
+ [ $_ts_m -gt 0 ] || [ $_ts_h -gt 0 ] && ret="$ret${_ts_m}m"
+
+ ret="$ret${_ts_s}s"
+ echo $ret
+}
+
+### Main
+
+report_file=$src_dir/report.html
+summary_file=$src_dir/summary.html
+
+passed=0
+failed=0
+total=0
+
+pass(){
+ passed=`expr $passed + 1`
+}
+
+fail(){
+ failed=`expr $failed + 1`
+}
+
+(
+ header Report $run $date
+ table "border=1"
+ row
+ column `bold Test case`
+ column `bold Result`
+ column `bold Elapsed`
+ column `bold Log`
+ end_row
+) > $report_file
+
+cat $src_file | while read line
+do
+ eval `echo $line | awk -F";" '{ printf("prg=\"%s\"; no=\"%s\"; res=\"%s\"; time=\"%s\"", $1, $2, $3, $4); }'`
+
+ prg=`trim $prg`
+ no=`trim $no`
+ res=`trim $res`
+ time=`trim $time`
+ res_dir="<a href=\"result.$no/\">log</a>"
+
+ ts=`time_spec $time`
+ res_txt=""
+ case $res in
+ 0) pass; res_txt="PASSED";;
+ *) fail; res_txt="FAILED";;
+ esac
+
+ if [ ! -d "$src_dir/result.$no" ]; then res_dir="&nbsp;"; fi
+
+ total=`expr $total + $time`
+
+ (
+ row
+ column $prg
+ column $res_txt
+ column $ts
+ column $res_dir
+ end_row
+ ) >> $report_file
+
+ (
+ row
+ column $run
+ column $date
+ column $passed
+ column $failed
+ column `time_spec $total`
+ column "<a href=\"result-$run/$date/report.html\">report</a>"
+ column "<a href=\"result-$run/$date/log.txt\">log.txt</a>"
+ end_row
+ ) > $summary_file
+done
+
+(
+ end_table
+ footer
+) >> $report_file
+
+exit 0
diff --git a/storage/ndb/test/run-test/make-index.sh b/storage/ndb/test/run-test/make-index.sh
new file mode 100755
index 00000000000..944f0df790b
--- /dev/null
+++ b/storage/ndb/test/run-test/make-index.sh
@@ -0,0 +1,242 @@
+#!/bin/sh
+# NAME
+# make-index.sh
+#
+# SYNOPSIS
+# make-index.sh [ -d <dir> ]
+#
+# DESCRIPTION
+#
+# OPTIONS
+#
+# EXAMPLES
+#
+#
+# ENVIRONMENT
+# NDB_PROJ_HOME Home dir for ndb
+#
+# FILES
+# $NDB_PROJ_HOME/lib/funcs.sh general shell script functions
+#
+#
+# SEE ALSO
+#
+# DIAGNOSTICTS
+#
+# VERSION
+# 1.0
+#
+# AUTHOR
+# Jonas Oreland
+#
+
+progname=`basename $0`
+synopsis="make-index.sh [ -d <dir> ]"
+
+: ${NDB_PROJ_HOME:?} # If undefined, exit with error message
+
+: ${NDB_LOCAL_BUILD_OPTIONS:=--} # If undef, set to --. Keeps getopts happy.
+ # You may have to experiment a bit
+ # to get quoting right (if you need it).
+
+
+. $NDB_PROJ_HOME/lib/funcs.sh # Load some good stuff
+
+# defaults for options related variables
+#
+
+dst_dir=/home/autotest/html
+report_date=`date '+%Y-%m-%d'`
+uniq_id=$$.$$
+verbose=yes
+
+# used if error when parsing the options environment variable
+#
+env_opterr="options environment variable: <<$options>>"
+
+# Option parsing, for the options variable as well as the command line.
+#
+# We want to be able to set options in an environment variable,
+# as well as on the command line. In order not to have to repeat
+# the same getopts information twice, we loop two times over the
+# getopts while loop. The first time, we process options from
+# the options environment variable, the second time we process
+# options from the command line.
+#
+# The things to change are the actual options and what they do.
+#
+#
+
+for optstring in "$options" "" # 1. options variable 2. cmd line
+do
+
+ while getopts q:s:R:d: i $optstring # optstring empty => no arg => cmd line
+ do
+ case $i in
+
+ q) verbose="";; # echo important things
+ d) dst_dir=$OPTARG;; # Destination directory
+ \?) syndie $env_opterr;; # print synopsis and exit
+
+ esac
+ done
+
+ [ -n "$optstring" ] && OPTIND=1 # Reset for round 2, cmdline options
+
+ env_opterr= # Round 2 should not use the value
+
+done
+shift `expr $OPTIND - 1`
+
+dst_dir=`abspath $dst_dir`
+
+###
+#
+# General html functions
+header(){
+ cat <<EOF
+<html><head><title>$*</title></head>
+<body>
+EOF
+}
+
+footer(){
+ cat <<EOF
+</body></html>
+EOF
+}
+
+heading(){
+ h=$1; shift
+ cat <<EOF
+<h$h>$*</h$h>
+EOF
+}
+
+table(){
+ echo "<table $*>"
+}
+
+end_table(){
+ echo "</table>"
+}
+
+row(){
+ echo "<tr>"
+}
+
+end_row(){
+ echo "</tr>"
+}
+
+c_column(){
+ cat <<EOF
+<td valign=center align=center>$*</td>
+EOF
+}
+
+bold(){
+ cat <<EOF
+<b>$*</b>
+EOF
+}
+column(){
+ cat <<EOF
+<td valign=center align=left>$*</td>
+EOF
+}
+
+para(){
+ cat <<EOF
+<p></p>
+EOF
+}
+
+hr(){
+ cat <<EOF
+<hr>
+EOF
+}
+
+inc_summary() {
+ grep -v 'html>' $2 | grep -v body | sed 's/href="/href="'$1'\//g'
+}
+
+# --- option parsing done ---
+
+
+
+# -- Verify
+trace "Verifying arguments"
+
+# --- option verifying done ---
+
+### Main
+
+# Re creating index
+trace "Creating index"
+(
+ header "Autotest super-duper index"
+ heading 1 "<center>Autotest super-duper index</center>"
+ cat -E README.autotest | sed 's/\$/<BR>/g'
+ echo "<br>"
+ echo "Current <a href="crontab.current">crontab</a> installed on mc01 running [" `uname -a` "]"
+ hr
+
+ dirs=`find $dst_dir -name 'summary.*.html' -type f -maxdepth 2 -exec dirname {} \; | sort -u`
+
+ dates=`find $dst_dir -name 'summary.*.html' -type f -maxdepth 2 -exec basename {} \; | sed 's/summary\.\(.*\)\.html/\1/g' | sort -u | sort -r`
+
+ echo "<p align=center>"
+
+#inline 5 latest reports
+ r_count=5
+ for d in $dates
+ do
+ for o in $dirs
+ do
+ o=`basename $o`
+ if [ -r $dst_dir/$o/summary.$d.html ]
+ then
+ inc_summary $o $dst_dir/$o/summary.$d.html
+ hr
+
+ r_count=`expr $r_count - 1`
+ if [ $r_count -eq 0 ]
+ then
+ break 2
+ fi
+ fi
+ done
+ done
+
+ table "border=1"
+ row
+ for i in $dirs
+ do
+ i=`basename $i`
+ column `bold $i`
+ done
+ end_row
+
+
+ for d in $dates
+ do
+ row
+ for o in $dirs
+ do
+ o=`basename $o`
+ if [ -r $dst_dir/$o/summary.$d.html ]
+ then
+ column "<a href=$o/summary.$d.html>$d</a>"
+ else
+ column ""
+ fi
+ done
+ end_row
+ done
+ end_table
+ footer
+) > $dst_dir/index.html
+
+exit 0
diff --git a/storage/ndb/test/run-test/ndb-autotest.sh b/storage/ndb/test/run-test/ndb-autotest.sh
new file mode 100755
index 00000000000..397df97d52f
--- /dev/null
+++ b/storage/ndb/test/run-test/ndb-autotest.sh
@@ -0,0 +1,228 @@
+#!/bin/sh
+
+save_args=$*
+VERSION="ndb-autotest.sh version 1.0"
+
+DATE=`date '+%Y-%m-%d'`
+export DATE
+
+set -e
+ulimit -Sc unlimited
+
+echo "`date` starting: $*"
+
+RSYNC_RSH=ssh
+export RSYNC_RSH
+
+do_clone=yes
+build=yes
+deploy=yes
+
+clone=5.0-ndb
+RUN="daily-basic daily-devel"
+conf=autotest.conf
+
+while [ "$1" ]
+do
+ case "$1" in
+ --no-clone) do_clone="";;
+ --no-build) build="";;
+ --no-deploy) deploy="";;
+ --clone=*) clone=`echo $1 | sed s/--clone=//`;;
+ --conf=*) conf=`echo $1 | sed s/--conf=//`;;
+ --version) echo $VERSION; exit;;
+ *) RUN=$*;;
+ esac
+ shift
+done
+
+if [ -f $conf ]
+then
+ . $conf
+else
+ echo "Can't find config file: $conf"
+ exit
+fi
+
+env
+
+LOCK=$HOME/.autotest-lock
+src_clone=$src_clone_base-$clone
+
+if [ -f $LOCK ]
+then
+ echo "Lock file exists: $LOCK"
+ exit 1
+fi
+
+echo "$DATE $RUN" > $LOCK
+trap "rm -f $LOCK" ERR
+
+dst_place=${build_dir}/clone-mysql-$clone-$DATE
+
+if [ "$do_clone" ]
+then
+ rm -rf $dst_place
+ bk clone $src_clone $dst_place
+fi
+
+if [ "$build" ]
+then
+ cd $dst_place
+ rm -rf $run_dir/*
+ aclocal; autoheader; autoconf; automake
+ (cd innobase; aclocal; autoheader; autoconf; automake)
+ (cd bdb/dist; sh s_all)
+ eval $configure --prefix=$run_dir
+ make
+ make install
+fi
+
+###
+# check script version
+#
+script=$run_dir/mysql-test/ndb/ndb-autotest.sh
+if [ -x $script ]
+then
+ $script --version > /tmp/version.$$
+else
+ echo $VERSION > /tmp/version.$$
+fi
+match=`grep -c "$VERSION" /tmp/version.$$`
+rm -f /tmp/version.$$
+if [ $match -eq 0 ]
+then
+ echo "Incorrect script version...restarting"
+ cp $run_dir/mysql-test/ndb/ndb-autotest.sh /tmp/at.$$.sh
+ rm -rf $run_dir $dst_place
+ sh /tmp/at.$$.sh $save_args
+ exit
+fi
+
+# Check that all interesting files are present
+test_dir=$run_dir/mysql-test/ndb
+atrt=$test_dir/atrt
+html=$test_dir/make-html-reports.sh
+PATH=$test_dir:$PATH
+export PATH
+
+filter(){
+ neg=$1
+ shift
+ while [ $# -gt 0 ]
+ do
+ if [ `grep -c $1 $neg` -eq 0 ] ; then echo $1; fi
+ shift
+ done
+}
+
+###
+# check ndb_cpcc fail hosts
+#
+ndb_cpcc $hosts | awk '{ if($1=="Failed"){ print;}}' > /tmp/failed.$DATE
+filter /tmp/failed.$DATE $hosts > /tmp/hosts.$DATE
+hosts=`cat /tmp/hosts.$DATE`
+
+if [ "$deploy" ]
+then
+ (cd / && tar cfz /tmp/build.$DATE.tgz $run_dir )
+ for i in $hosts
+ do
+ ok=0
+ scp /tmp/build.$DATE.tgz $i:/tmp/build.$DATE.$$.tgz && \
+ ssh $i "rm -rf /space/autotest/*" && \
+ ssh $i "cd / && tar xfz /tmp/build.$DATE.$$.tgz" && \
+ ssh $i "rm /tmp/build.$DATE.$$.tgz" && ok=1
+ if [ $ok -eq 0 ]
+ then
+ echo "$i failed during scp/ssh, excluding"
+ echo $i >> /tmp/failed.$DATE
+ fi
+ done
+fi
+rm -f /tmp/build.$DATE.tgz
+
+###
+# handle scp failed hosts
+#
+filter /tmp/failed.$DATE $hosts > /tmp/hosts.$DATE
+hosts=`cat /tmp/hosts.$DATE`
+cat /tmp/failed.$DATE > /tmp/filter_hosts.$$
+
+###
+# functions for running atrt
+#
+choose(){
+ SRC=$1
+ TMP1=/tmp/choose.$$
+ TMP2=/tmp/choose.$$.$$
+ shift
+
+ cp $SRC $TMP1
+ i=1
+ while [ $# -gt 0 ]
+ do
+ sed -e s,"CHOOSE_host$i",$1,g < $TMP1 > $TMP2
+ mv $TMP2 $TMP1
+ shift
+ i=`expr $i + 1`
+ done
+ cat $TMP1
+ rm -f $TMP1
+}
+start(){
+ rm -rf report.txt result* log.txt
+ $atrt -v -v -r -R --log-file=log.txt --testcase-file=$test_dir/$2-tests.txt &
+ pid=$!
+ echo $pid > run.pid
+ wait $pid
+ rm run.pid
+ [ -f log.txt ] && mv log.txt $3
+ [ -f report.txt ] && mv report.txt $3
+ [ "`find . -name 'result*'`" ] && mv result* $3
+ cd $3
+ sh $html . $1 $DATE
+ cd ..
+ p2=`pwd`
+ cd ..
+ tar cfz /tmp/res.$$.tgz `basename $p2`/$DATE
+ scp /tmp/res.$$.tgz $result_host:$result_path
+ ssh $result_host "cd $result_path && tar xfz res.$$.tgz && rm -f res.$$.tgz"
+ rm -f /tmp/res.$$.tgz
+}
+
+p=`pwd`
+for dir in $RUN
+do
+ echo "Fixing hosts for $dir"
+
+ run_dir=$base_dir/run-$dir-mysql-$clone-$target
+ res_dir=$base_dir/result-$dir-mysql-$clone-$target/$DATE
+
+ mkdir -p $res_dir
+ rm -rf $res_dir/*
+
+ count=`grep -c "COMPUTER" $run_dir/1.ndb_mgmd/initconfig.template`
+ avail_hosts=`filter /tmp/filter_hosts.$$ $hosts`
+ avail=`echo $avail_hosts | wc -w`
+ if [ $count -gt $avail ]
+ then
+ echo "Not enough hosts"
+ echo "Needs: $count available: $avail ($avail_hosts)"
+ break;
+ fi
+
+ run_hosts=`echo $avail_hosts| awk '{for(i=1;i<='$count';i++)print $i;}'`
+ choose $run_dir/d.template $run_hosts > $run_dir/d.txt
+ choose $run_dir/1.ndb_mgmd/initconfig.template $run_hosts > $run_dir/1.ndb_mgmd/config.ini
+ echo $run_hosts >> /tmp/filter_hosts.$$
+
+ cd $run_dir
+ start $dir-mysql-$clone-$target $dir $res_dir &
+done
+cd $p
+rm /tmp/filter_hosts.$$
+
+wait
+
+rm -f $LOCK
diff --git a/storage/ndb/test/run-test/run-test.hpp b/storage/ndb/test/run-test/run-test.hpp
new file mode 100644
index 00000000000..ff7f916d4ef
--- /dev/null
+++ b/storage/ndb/test/run-test/run-test.hpp
@@ -0,0 +1,95 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef atrt_config_hpp
+#define atrt_config_hpp
+
+#include <getarg.h>
+#include <Vector.hpp>
+#include <BaseString.hpp>
+#include <Logger.hpp>
+#include <mgmapi.h>
+#include <CpcClient.hpp>
+
+#undef MYSQL_CLIENT
+
+enum ErrorCodes {
+ ERR_OK = 0,
+ ERR_NDB_FAILED = 101,
+ ERR_SERVERS_FAILED = 102,
+ ERR_MAX_TIME_ELAPSED = 103
+};
+
+struct atrt_host {
+ size_t m_index;
+ BaseString m_user;
+ BaseString m_base_dir;
+ BaseString m_hostname;
+ SimpleCpcClient * m_cpcd;
+};
+
+struct atrt_process {
+ size_t m_index;
+ BaseString m_hostname;
+ struct atrt_host * m_host;
+
+ enum Type {
+ ALL = 255,
+ NDB_DB = 1,
+ NDB_API = 2,
+ NDB_MGM = 4,
+ NDB_REP = 8,
+ MYSQL_SERVER = 16,
+ MYSQL_CLIENT = 32
+ } m_type;
+
+ SimpleCpcClient::Process m_proc;
+ short m_ndb_mgm_port;
+ NdbMgmHandle m_ndb_mgm_handle; // if type == ndb_mgm
+};
+
+struct atrt_config {
+ BaseString m_key;
+ Vector<atrt_host> m_hosts;
+ Vector<atrt_process> m_processes;
+};
+
+struct atrt_testcase {
+ bool m_report;
+ time_t m_max_time;
+ BaseString m_command;
+ BaseString m_args;
+};
+
+extern Logger g_logger;
+
+bool parse_args(int argc, const char** argv);
+bool setup_config(atrt_config&);
+bool connect_hosts(atrt_config&);
+bool connect_ndb_mgm(atrt_config&);
+bool wait_ndb(atrt_config&, int ndb_mgm_node_status);
+bool start_processes(atrt_config&, int);
+bool stop_processes(atrt_config&, int);
+bool update_status(atrt_config&, int);
+int is_running(atrt_config&, int);
+bool gather_result(atrt_config&, int * result);
+
+bool read_test_case(FILE *, atrt_testcase&, int& line);
+bool setup_test_case(atrt_config&, const atrt_testcase&);
+
+bool setup_hosts(atrt_config&);
+
+#endif