[Rcpp-commits] r1753 - in pkg/Rcpp: . inst inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 27 19:06:34 CEST 2010


Author: edd
Date: 2010-06-27 19:06:33 +0200 (Sun, 27 Jun 2010)
New Revision: 1753

Modified:
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/TODO
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/unitTests/runTests.R
Log:
reduce the number of tests run when on Windows (and --allTests not given) by
setting the regexp on filenames to [D-Z] yielding 38 instead of 45 files


Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2010-06-27 12:24:13 UTC (rev 1752)
+++ pkg/Rcpp/DESCRIPTION	2010-06-27 17:06:33 UTC (rev 1753)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Rcpp R/C++ interface package
-Version: 0.8.2.13
+Version: 0.8.2.14
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, with contributions 
  by Simon Urbanek, David Reiss and Douglas Bates; based on code written during 

Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO	2010-06-27 12:24:13 UTC (rev 1752)
+++ pkg/Rcpp/TODO	2010-06-27 17:06:33 UTC (rev 1753)
@@ -20,7 +20,7 @@
     o   Rcpp::Factor and Rcpp::Ordered
 
 
-Modules: 
+Modules 
 
     o   Exposing constructors. For now we can only construct internal objects 
         with the default constructor of the target class. Maybe we can provide
@@ -81,20 +81,25 @@
           ## This will cause R CMD check to return error and stop
           err <- getErrors(tests)
           if( (err$nFail + err$nErr) > 0) {
-              stop( sprintf( "unit test problems: %d failures, %d errors", err$nFail, err$nErr) )
+              stop( sprintf( "unit test problems: %d failures, %d errors", 
+                             err$nFail, err$nErr) )
           } else{
               success <- err$nTestFunc - err$nFail - err$nErr - err$nDeactivated
               cat( sprintf( "%d / %d\n", success, err$nTestFunc ) )
           }
        
-        by something that extract information from "err". This is needed because
-        on win builder or cran checks, we only ever get the last 13 lines of 
-        output. So we need to make the best use of these 13 lines
+        by something that extract information from "err". This is needed
+        because on win builder or cran checks, we only ever get the last 13
+        lines of output. So we need to make the best use of these 13 lines
         
-   o    Testing has become slow. That would be good to find ways to make it faster
-        such as combine multiple functions in a single cxxfunction call or alternatively
-        make another package (perhaps internal to this one that would contain 
-        test cases)
+   o    Testing has become slow. That would be good to find ways to make it
+        faster such as combine multiple functions in a single cxxfunction
+        call or alternatively make another package (perhaps internal to this
+        one that would contain test cases)
                 
    o    Maybe make test function 'tier one' and 'tier two' and only the
         second tier if an (environment ?) variable has been set?
+
+   o    We now have more tests than we can run in the time budget permitted by
+        the Windows build infrastructure. Hence, we need a better ordering of
+        which tests to run.

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-06-27 12:24:13 UTC (rev 1752)
+++ pkg/Rcpp/inst/ChangeLog	2010-06-27 17:06:33 UTC (rev 1753)
@@ -1,3 +1,11 @@
+2010-06-27  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/unitTests/runTests.R: Stop-gap measure to reduce the number of
+	tests run on Windows as we now have so many tests that the build
+	exceeds the time limit granted by the win-builder service. The forced
+	reduction of tests can be overcome by adding --allTests as a
+	command-line argument on Windows, or by running on another platform.
+
 2010-06-25  Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/posix.h: anticipate R 2.12.0 switch of classes
@@ -9,9 +17,9 @@
 
 2010-06-24  Romain Francois <romain at r-enthusiasts.com>
 
-	* inst/include/Rcpp/vector/RangeIndexer.h: factored the RangeIndexer class
-	out of Vector, so that we can at a later time specialize it for character
-	vectors, lists, etc ...
+	* inst/include/Rcpp/vector/RangeIndexer.h: factored the RangeIndexer
+	class out of Vector, so that we can at a later time specialize it for
+	character vectors, lists, etc ...
 
 2010-06-24  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/Rcpp/inst/unitTests/runTests.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runTests.R	2010-06-27 12:24:13 UTC (rev 1752)
+++ pkg/Rcpp/inst/unitTests/runTests.R	2010-06-27 17:06:33 UTC (rev 1753)
@@ -1,15 +1,34 @@
+## -*- mode: R; tab-width: 4 -*-
+##
+## Copyright (C) 2009- 2010	Dirk Eddelbuettel and Romain Francois
+##
+## This file is part of Rcpp.
+##
+## Rcpp 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.
+##
+## Rcpp 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 Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+
 pkg <- "Rcpp"
 
 if( ! require( "inline", character.only = TRUE, quietly = TRUE ) ){
-	stop( "The inline package is required to run Rcpp unit tests" )
+    stop( "The inline package is required to run Rcpp unit tests" )
 }
 
 if( compareVersion( packageDescription( "inline" )[["Version"]], "0.3.4.4" ) < 0 ){
-	stop( "Rcpp unit tests need at least the version 0.3.4.4 of inline" )
+    stop( "Rcpp unit tests need at least the version 0.3.4.4 of inline" )
 }
 
 cppfunction <- function(...){
-	cxxfunction( ..., plugin = "Rcpp" )
+    cxxfunction( ..., plugin = "Rcpp" )
 }
 
 if(require("RUnit", quietly = TRUE)) {
@@ -19,8 +38,8 @@
     	if( "--local" %in% commandArgs(TRUE) ) return(TRUE)
     	FALSE
     }
-    if( is_local() ) path <- getwd()
-    
+    if (is_local() ) path <- getwd()
+
     library(package=pkg, character.only = TRUE)
     if(!(exists("path") && file.exists(path)))
         path <- system.file("unitTests", package = pkg)
@@ -29,10 +48,25 @@
 
     ## Define tests
     testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs = path
-    	# , testFileRegexp = "runit.Argument.R"
-    )
+                                        # , testFileRegexp = "runit.Argument.R"
+                                 )
 
-    if(interactive()) {
+    ## this is crass but as we time out on Windows we have no choice
+    ## but to disable a number of tests
+    ## TODO: actually prioritize which ones we want
+    allTests <- function() {
+        if (.Platform$OS.type != "windows") return(TRUE)
+    	if (exists( "argv", globalenv() ) && "--allTests" %in% argv) return(TRUE)
+    	if ("--allTests" %in% commandArgs(TRUE)) return(TRUE)
+    	return(FALSE)
+    }
+    if (.Platform$OS.type == "windows" && allTests() == FALSE) {
+        ## by imposing [D-Z] (instead of an implicit A-Z) we are going from
+        ## 45 tests to run down to 38 (numbers as of release 0.8.3)
+        testSuite$testFileRegexp <- "^runit.[D-Z]+\\.[rR]$"
+    }
+
+    if (interactive()) {
         cat("Now have RUnit Test Suite 'testSuite' for package '", pkg,
             "' :\n", sep='')
         str(testSuite)
@@ -40,59 +74,60 @@
             "\t  tests <- runTestSuite(testSuite)", "\nand later",
             "\t  printTextProtocol(tests)", '', sep="\n")
     } else { ## run from shell / Rscript / R CMD Batch / ...
+
         ## Run
         tests <- runTestSuite(testSuite)
-        
+
         output <- NULL
-        
+
         process_args <- function(argv){
-        	if( !is.null(argv) && length(argv) > 0 ){
-        		rx <- "^--output=(.*)$"
-        		g  <- grep( rx, argv, value = TRUE )
-        		if( length(g) ){
-        			sub( rx, "\\1", g[1L] )
-        		}
-        	}
+            if( !is.null(argv) && length(argv) > 0 ){
+                rx <- "^--output=(.*)$"
+                g  <- grep( rx, argv, value = TRUE )
+                if( length(g) ){
+                    sub( rx, "\\1", g[1L] )
+                }
+            }
         }
-               
-        # R CMD check uses this
+
+                                        # R CMD check uses this
         if( exists( "Rcpp.unit.test.output.dir", globalenv() ) ){
-			output <- Rcpp.unit.test.output.dir
-		} else {
-          
-        	# give a chance to the user to customize where he/she wants 
-        	# the unit tests results to be stored with the --output= command 
-        	# line argument
-        	if( exists( "argv",  globalenv() ) ){
-        		# littler
-        		output <- process_args(argv)
-        	} else {
-        		# Rscript
-        		output <- process_args(commandArgs(TRUE))
-        	}
+            output <- Rcpp.unit.test.output.dir
+        } else {
+
+            ## give a chance to the user to customize where he/she wants
+            ## the unit tests results to be stored with the --output= command
+            ## line argument
+            if( exists( "argv",  globalenv() ) ){
+                ## littler
+                output <- process_args(argv)
+            } else {
+                ## Rscript
+                output <- process_args(commandArgs(TRUE))
+            }
         }
-        
-        # if it did not work, try to use /tmp
+
+                                        # if it did not work, try to use /tmp
         if( is.null(output) ){
-        	if( file.exists( "/tmp" ) ){
-        		output <- "/tmp"
-        	} else{
-        		output <- getwd()
-        	}
+            if( file.exists( "/tmp" ) ){
+                output <- "/tmp"
+            } else{
+                output <- getwd()
+            }
         }
-        
+
         ## Print results
         output.txt  <- file.path( output, sprintf("%s-unitTests.txt", pkg))
         output.html <- file.path( output, sprintf("%s-unitTests.html", pkg))
-       
+
         printTextProtocol(tests, fileName=output.txt)
         message( sprintf( "saving txt unit test report to '%s'", output.txt ) )
-        
+
         ## Print HTML version to a file
         ## printHTMLProtocol has problems on Mac OS X
         if (Sys.info()["sysname"] != "Darwin"){
-        	message( sprintf( "saving html unit test report to '%s'", output.html ) )
-        	printHTMLProtocol(tests, fileName=output.html)
+            message( sprintf( "saving html unit test report to '%s'", output.html ) )
+            printHTMLProtocol(tests, fileName=output.html)
         }
 
         ##  stop() if there are any failures i.e. FALSE to unit test.
@@ -101,12 +136,13 @@
         if( (err$nFail + err$nErr) > 0) {
             stop( sprintf( "unit test problems: %d failures, %d errors", err$nFail, err$nErr) )
         } else{
-        	success <- err$nTestFunc - err$nFail - err$nErr - err$nDeactivated
-        	cat( sprintf( "%d / %d\n", success, err$nTestFunc ) )
+            success <- err$nTestFunc - err$nFail - err$nErr - err$nDeactivated
+            cat( sprintf( "%d / %d\n", success, err$nTestFunc ) )
         }
     }
+
 } else {
     cat("R package 'RUnit' cannot be loaded -- no unit tests run\n",
-    "for package", pkg,"\n")
+        "for package", pkg,"\n")
 }
 



More information about the Rcpp-commits mailing list