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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 23 14:57:38 CET 2011


Author: edd
Date: 2011-12-23 14:57:38 +0100 (Fri, 23 Dec 2011)
New Revision: 3430

Modified:
   pkg/RcppGSL/ChangeLog
   pkg/RcppGSL/inst/unitTests/runTests.R
Log:
modify fallback location of unitTest output files to be the RcppArmadillo.Rcheck/ dir


Modified: pkg/RcppGSL/ChangeLog
===================================================================
--- pkg/RcppGSL/ChangeLog	2011-12-23 13:55:32 UTC (rev 3429)
+++ pkg/RcppGSL/ChangeLog	2011-12-23 13:57:38 UTC (rev 3430)
@@ -1,3 +1,8 @@
+2011-12-23  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/unitTests/runTests.R: unit tests output 'fallback' directory
+	changed to '..' and files are now in top-level of $pkg.Rcheck/
+
 2011-12-22  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/RcppGSLForward.h (RcppGSL): Commented-out long and

Modified: pkg/RcppGSL/inst/unitTests/runTests.R
===================================================================
--- pkg/RcppGSL/inst/unitTests/runTests.R	2011-12-23 13:55:32 UTC (rev 3429)
+++ pkg/RcppGSL/inst/unitTests/runTests.R	2011-12-23 13:57:38 UTC (rev 3430)
@@ -43,29 +43,23 @@
 
         # 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))
-        	}
-        	
-        	# if it did not work, try to use /tmp
-        	if( is.null(output) ){
-        		if( file.exists( "/tmp" ) ){
-        			output <- "/tmp"
-        		} else{
-        			output <- getwd()
-        		}
-        	}
+            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( is.null(output) ) {         # if it did not work, use parent dir
+            output <- ".."              # as BDR does not want /tmp to be used
+        }
+
         ## Print results
         output.txt  <- file.path( output, sprintf("%s-unitTests.txt", pkg))
         output.html <- file.path( output, sprintf("%s-unitTests.html", pkg))
@@ -76,18 +70,18 @@
         ## 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.
         ## 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 ) )
+            success <- err$nTestFunc - err$nFail - err$nErr - err$nDeactivated
+            cat( sprintf( "%d / %d\n", success, err$nTestFunc ) )
         }
     }
 } else {



More information about the Rcpp-commits mailing list