File: runTestSuite.sh

package info (click to toggle)
r-cran-foreach 1.4.0-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 784 kB
  • sloc: sh: 58; makefile: 1
file content (69 lines) | stat: -rw-r--r-- 1,666 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

LOGFILE=test.log

R --vanilla --slave > ${LOGFILE} 2>&1 <<'EOF'
library(foreach)
library(RUnit)

verbose <- as.logical(Sys.getenv('FOREACH_VERBOSE', 'FALSE'))
method <- Sys.getenv('FOREACH_BACKEND', 'SEQ')

if (method == 'SNOW') {
  cat('** Using SNOW backend\n')
  library(doSNOW)
  cl <- makeSOCKcluster(3)
  .Last <- function() {
    cat('shutting down SOCK cluster...\n')
    stopCluster(cl)
    cat('shutdown complete\n')
  }
  registerDoSNOW(cl)
} else if (method == 'NWS') {
  cat('** Using NWS backend\n')
  library(doNWS)
  registerDoNWS()
} else if (method == 'MC') {
  cat('** Using multicore backend\n')
  library(doMC)
  registerDoMC()
} else if (method == 'SEQ') {
  cat('** Using sequential backend\n')
  registerDoSEQ()
} else {
  stop('illegal backend specified: ', method)
}

options(warn=1)
options(showWarnCalls=TRUE)

cat('Starting test at', date(), '\n')
cat(sprintf('doPar backend name: %s, version: %s\n', getDoParName(), getDoParVersion()))
cat(sprintf('Running with %d worker(s)\n', getDoParWorkers()))

tests <- c('foreachTest.R', 'errorTest.R', 'combineTest.R', 'iteratorTest.R',
           'loadFactorTest.R', 'nestedTest.R', 'packagesTest.R', 'mergeTest.R',
           'whenTest.R', 'stressTest.R')

errcase <- list()
for (f in tests) {
  cat('\nRunning test file:', f, '\n')
  t <- runTestFile(f)
  e <- getErrors(t)
  if (e$nErr + e$nFail > 0) {
    errcase <- c(errcase, t)
    print(t)
  }
}

if (length(errcase) == 0) {
  cat('*** Ran all tests successfully ***\n')
} else {
  cat('!!! Encountered', length(errcase), 'problems !!!\n')
  for (t in errcase) {
    print(t)
  }
}

cat('Finished test at', date(), '\n')
EOF