LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  November 2015

HPS-SVN November 2015

Subject:

r3916 - in /java/trunk/integration-tests: ./ src/test/java/org/hps/test/it/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 2 Nov 2015 13:55:06 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (516 lines)

Author: [log in to unmask]
Date: Mon Nov  2 05:55:03 2015
New Revision: 3916

Log:
Use test data jar instead of file cache in integration tests.

Added:
    java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconNoReadoutTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconSteeringTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/ReconSteeringTest.java
Modified:
    java/trunk/integration-tests/   (props changed)
    java/trunk/integration-tests/pom.xml
    java/trunk/integration-tests/src/test/java/org/hps/test/it/EngRun2015ReconTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutNoPileupTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutToLcioTest.java
    java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java

Modified: java/trunk/integration-tests/pom.xml
 =============================================================================
--- java/trunk/integration-tests/pom.xml	(original)
+++ java/trunk/integration-tests/pom.xml	Mon Nov  2 05:55:03 2015
@@ -20,6 +20,21 @@
             <artifactId>hps-distribution</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.hps</groupId>
+            <artifactId>hps-test-data</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+            <classifier>archive</classifier>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.hps</groupId>
+            <artifactId>hps-test-data</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+            <type>jar</type>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
@@ -27,13 +42,28 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>                                 
                 <configuration>
-                    <forkCount>1</forkCount>
-                    <reuseForks>false</reuseForks>
-                    <trimStackTrace>false</trimStackTrace>
-                    <excludes>
-                        <exclude>org/hps/test/it/DataQualityMonitorTest.java</exclude>
-                    </excludes>
+                    <skipTests>true</skipTests>
                 </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.19</version>
+                <configuration>
+                    <argLine>-server -Xmx2g -XX:MaxPermSize=512m -Djava.util.logging.config.class=org.hps.logging.config.TestLoggingConfig</argLine>
+                    <forkMode>always</forkMode>
+                    <includes>
+                        <include>org/hps/test/it/*Test.java</include>
+                    </includes>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
     </build>

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/EngRun2015ReconTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/EngRun2015ReconTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/EngRun2015ReconTest.java	Mon Nov  2 05:55:03 2015
@@ -2,44 +2,33 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URL;
 import java.util.List;
 
 import junit.framework.TestCase;
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
 
+import org.hps.data.test.TestDataUtility;
 import org.hps.evio.EvioToLcio;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.ReconstructedParticle;
 import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
 import org.lcsim.util.loop.LCSimLoop;
 import org.lcsim.util.test.TestUtil.TestOutputFile;
 
 /**
- * Test to run the standard reconstruction on Engineering Run 2015 EVIO data.
- * Full energy electron candidate events were selected from pass1 output. The
- * current test runs the default reconstruction over the evio file then analyzes
- * the output lcio file. The current checks are minimal and need to be improved.
+ * Test to run the standard reconstruction on Engineering Run 2015 EVIO data. Full energy electron candidate events were
+ * selected from pass1 output. The current test runs the default reconstruction over the evio file then analyzes the
+ * output lcio file. The current checks are minimal and need to be improved.
  *
  * @author Norman A Graf
  */
-public class EngRun2015ReconTest extends TestCase
-{
-
-    final static String fileLocation = "http://www.lcsim.org/test/hps-java/run5772_integrationTest.evio";
-//final static String fileLocation = "http://www.lcsim.org/test/hps-java/run5772_pass1_stripOneFee_5000Events.evio";
-
-    public void testEngRun2015Recon() throws Exception
-    {
-        System.out.println("Caching file...");
-        FileCache cache = new FileCache();
-        File inputFile = cache.getCachedFile(new URL(fileLocation));
+public class EngRun2015ReconTest extends TestCase {
+  
+    public void testEngRun2015Recon() throws Exception {
+        File inputFile = new TestDataUtility().getTestData("run5772_integrationTest.evio");        
         File outputFile = new TestOutputFile("EngRun2015ReconTest");
         String args[] = {"-r", "-x", "/org/hps/steering/recon/EngineeringRun2015FullRecon_Pass2.lcsim", "-d",
-            "HPS-EngRun2015-Nominal-v2", "-D", "outputFile=" + outputFile.getPath(), inputFile.getPath(), "-n",
-            "1000"};
+                "HPS-EngRun2015-Nominal-v2", "-D", "outputFile=" + outputFile.getPath(), "-n", "1000",
+                inputFile.getPath()};
         System.out.println("Running EngRun2015ReconTest.main ...");
         System.out.println("writing to: " + outputFile.getPath());
         long startTime = System.currentTimeMillis();
@@ -60,14 +49,12 @@
         System.out.println("Done!");
     }
 
-    static class ReconCheckDriver extends Driver
-    {
+    static class ReconCheckDriver extends Driver {
 
         int nFail;
         int nProcessed;
 
-        public void process(EventHeader event)
-        {
+        public void process(EventHeader event) {
             boolean fail = false;
             List<ReconstructedParticle> rps = event.get(ReconstructedParticle.class, "FinalStateParticles");
             int nrp = rps.size();
@@ -108,8 +95,7 @@
             // TODO add checks on quality of output (chi2, p, E, E/p matching, position matching, etc.)
         }
 
-        public void endOfData()
-        {
+        public void endOfData() {
             System.out.println(nFail + " of " + nProcessed + " events failed");
             assertEquals("Expected no events to fail", nFail, 0);
         }

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java	Mon Nov  2 05:55:03 2015
@@ -152,7 +152,7 @@
     /**
      * The default input file (large file at SLAC so the pom.xml file excludes this test on non-SLAC hosts).
      */
-    private static final String INPUT_FILE = "/nfs/slac/g/hps3/data/engrun/evio/hps_005772.evio.0";
+    private static final String INPUT_FILE = "/nfs/slac/g/hps3/data/engrun2015/evio/hps_005772.evio.0";
 
     /**
      * The number of events that should be processed.
@@ -175,8 +175,8 @@
         final TestOutputFile outputFile = new TestOutputFile(EvioToLcioTest.class, "hps_005772.slcio");
 
         // Run the command line utility.
-        final String[] args = new String[] {"-l", outputFile.getPath(), "-d", "HPS-EngRun2015-Nominal-v1", INPUT_FILE,
-                "-r", "-x", "/org/hps/steering/EventMarker.lcsim"};
+        final String[] args = new String[] {"-l", outputFile.getPath(), "-d", "HPS-EngRun2015-Nominal-v1", "-r", "-x", 
+                "/org/hps/steering/EventMarker.lcsim", INPUT_FILE};
         System.out.println("Running EvioToLcio on " + INPUT_FILE);
         Logger.getLogger("org.hps.evio").setLevel(Level.WARNING);
         System.out.println("org.hps.evio logging level is " + Logger.getLogger("org.hps.evio").getLevel());

Added: java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconNoReadoutTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconNoReadoutTest.java	(added)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconNoReadoutTest.java	Mon Nov  2 05:55:03 2015
@@ -0,0 +1,43 @@
+package org.hps.test.it;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.hps.data.test.TestDataUtility;
+import org.hps.job.JobManager;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
+/**
+ * Test MC recon steering file without readout simulation.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+public class MCReconNoReadoutTest extends TestCase {
+    
+    /**
+     * List of steering files to run.
+     */
+    static String[] STEERING_FILES = {
+        "/org/hps/steering/readout/HPSReconNoReadout.lcsim"
+    };
+    
+    /**
+     * Test recon steering files.
+     * @throws Exception if any error occurs running the recon job
+     */
+    public void testSteeringFiles() throws Exception {
+        
+        File inputFile = new TestDataUtility().getTestData("e-_1.056GeV_SLIC-v05-00-00_Geant4-v10-01-02_QGSP_BERT_HPS-EngRun2015-Nominal-v3.slcio");
+        
+        for (String steeringFile : STEERING_FILES) {
+            System.out.println("running steering file " + steeringFile);            
+            File outputFile = new TestOutputFile(new File(steeringFile).getName().replace(".lcsim", ""));
+            JobManager job = new JobManager();
+            job.addVariableDefinition("outputFile", outputFile.getPath());
+            job.addInputFile(inputFile);
+            job.setup(steeringFile);
+            job.run();
+        }
+    }        
+}

Added: java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconSteeringTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconSteeringTest.java	(added)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/MCReconSteeringTest.java	Mon Nov  2 05:55:03 2015
@@ -0,0 +1,61 @@
+package org.hps.test.it;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.hps.data.test.TestDataUtility;
+import org.hps.job.JobManager;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
+/**
+ * Test that production MC recon steering files are not broken.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+public class MCReconSteeringTest extends TestCase {
+    
+    /**
+     * List of steering files to run.
+     */
+    static String[] STEERING_FILES = {        
+        "EngineeringRun2015FullReconMC_Pass2.lcsim",
+        "EngineeringRun2015FullReconMC.lcsim"
+    };
+            
+    /**
+     * Test recon steering files.
+     * @throws Exception if any error occurs running the recon job
+     */
+    public void testSteeringFiles() {
+        
+        File inputFile = new TestDataUtility().getTestData("tritrigv1-egsv3-triv2-g4v1_s2d6_HPS-EngRun2015-Nominal-v3_3.4.0_pairs1_1.slcio");
+        
+        for (String steeringFile : STEERING_FILES) {
+            System.out.println("Running steering file " + steeringFile + " ...");
+            boolean failed = false;
+            try {                
+                testSteering("/org/hps/steering/recon/" + steeringFile, inputFile);
+                System.out.println("Job with steering " + steeringFile + " ran okay!");
+            } catch (Exception e) { 
+                System.out.println("caught exception: " + e.getMessage());
+                e.printStackTrace();
+                System.out.println("Job with steering " + steeringFile + " failed!");
+                failed = true;
+            }
+            System.out.println(steeringFile + " failed: " + failed);
+        }
+    }
+    
+    private void testSteering(String steeringFile, File inputFile) {
+        File outputFile = new TestOutputFile(new File(steeringFile).getName().replace(".lcsim", ""));
+        JobManager job = new JobManager();
+        job.addVariableDefinition("outputFile", outputFile.getPath());
+        job.addVariableDefinition("detector", "HPS-EngRun2015-Nominal-v3");
+        job.addVariableDefinition("run", "5772");
+        job.addInputFile(inputFile);
+        job.setup(steeringFile);
+        job.run();
+        System.out.println("Job " + steeringFile + " processed " + job.getLCSimLoop().getTotalCountableConsumed() + " events.");
+    }
+}

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutNoPileupTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutNoPileupTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutNoPileupTest.java	Mon Nov  2 05:55:03 2015
@@ -5,6 +5,7 @@
 
 import junit.framework.TestCase;
 
+import org.hps.data.test.TestDataUtility;
 import org.hps.job.JobManager;
 import org.lcsim.util.cache.FileCache;
 import org.lcsim.util.test.TestUtil.TestOutputFile;
@@ -29,11 +30,8 @@
     static final int nEvents = 100;
     
     public void testReadoutNoPileup() throws Exception {
-        new TestOutputFile(this.getClass().getSimpleName()).mkdir();
-        
-        FileCache cache = new FileCache();
-        File inputFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/ReadoutNoPileupTest.slcio"));
-        
+        new TestOutputFile(this.getClass().getSimpleName()).mkdir();        
+        File inputFile = new TestDataUtility().getTestData("ReadoutNoPileupTest.slcio");
         JobManager job = new JobManager();
         job.addInputFile(inputFile);
         job.addVariableDefinition("detector", "HPS-Proposal2014-v8-2pt2");

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutToLcioTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutToLcioTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/ReadoutToLcioTest.java	Mon Nov  2 05:55:03 2015
@@ -1,12 +1,11 @@
 package org.hps.test.it;
 
 import java.io.File;
-import java.net.URL;
 
 import junit.framework.TestCase;
 
+import org.hps.data.test.TestDataUtility;
 import org.hps.job.JobManager;
-import org.lcsim.util.cache.FileCache;
 import org.lcsim.util.test.TestUtil.TestOutputFile;
 
 /**
@@ -27,11 +26,9 @@
     
     public void testReadoutToLcio() throws Exception {
         
-        new TestOutputFile(this.getClass().getSimpleName()).mkdir();
-        
-        FileCache cache = new FileCache();
-        File inputFile = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps-java/ReadoutToLcioTest.slcio"));
-        
+        new TestOutputFile(this.getClass().getSimpleName()).mkdir();        
+        File inputFile = new TestDataUtility().getTestData("ReadoutToLcioTest.slcio");
+                
         JobManager job = new JobManager();
         job.addVariableDefinition("detector", "HPS-Proposal2014-v8-2pt2");
         job.addVariableDefinition("run", "0");

Added: java/trunk/integration-tests/src/test/java/org/hps/test/it/ReconSteeringTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/ReconSteeringTest.java	(added)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/ReconSteeringTest.java	Mon Nov  2 05:55:03 2015
@@ -0,0 +1,100 @@
+package org.hps.test.it;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.hps.data.test.TestDataUtility;
+import org.hps.job.JobManager;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.test.TestUtil.TestOutputFile;
+
+/**
+ * Test that production MC recon steering files are not broken by running an LCSim job on them
+ * using an LCIO file.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+public class ReconSteeringTest extends TestCase {
+    
+    /**
+     * List of steering files to run.
+     */
+    final static String[] STEERING_FILES = {
+        "EngineeringRun2014EcalRecon_Pass1.lcsim",
+        "EngineeringRun2014EcalRecon.lcsim",
+        "EngineeringRun2015EcalRecon.lcsim",
+        "EngineeringRun2015FullRecon.lcsim",
+        "EngineeringRun2015FullRecon_Pass2.lcsim",
+        "EngineeringRun2015HitRecon.lcsim",
+        "HPSTrackingDefaultsRecon.lcsim"
+    };
+            
+    /**
+     * Test recon steering files.
+     * @throws Exception if any error occurs running the recon job
+     */
+    public void testSteeringFiles() {
+        
+        File inputFile = new TestDataUtility().getTestData("tritrigv1-egsv3-triv2-g4v1_s2d6_HPS-EngRun2015-Nominal-v3_3.4.0_pairs1_1.slcio");
+        
+        for (String steeringFile : STEERING_FILES) {
+            
+            // Run the reconstruction steering file.
+            File outputFile = null;
+            try {
+                outputFile = new TestOutputFile(new File(steeringFile).getName().replace(".lcsim", ""));
+                runSteering("/org/hps/steering/recon/" + steeringFile, inputFile, outputFile);
+            } catch (Throwable e) {
+                System.err.println("Job with steering " + steeringFile + " failed!");
+                throw new RuntimeException("Recon job failed.", e);
+            }
+            
+            Runtime runtime = Runtime.getRuntime();
+            
+            int mb = 1024 * 1024;
+            
+            System.out.println("total memory: " + runtime.totalMemory() / mb);
+            System.out.println("free memory: " + runtime.freeMemory() / mb);
+            System.out.println("max memory: " + runtime.maxMemory() / mb);
+            System.out.println("used memory: " + (runtime.totalMemory() - runtime.freeMemory()) / mb);
+            
+            System.gc();
+            
+            // Create DQM output for QA.
+            try {
+                runDQM(outputFile);
+            } catch (Throwable e) {
+                throw new RuntimeException("The DQM job failed.", e);
+            }
+        }
+    }
+       
+    private void runSteering(String steeringFile, File inputFile, File outputFile) {
+        System.out.println("Testing steering file " + steeringFile + " ...");
+        JobManager job = new JobManager();
+        job.addVariableDefinition("outputFile", outputFile.getPath());
+        job.addVariableDefinition("detector", "HPS-EngRun2015-Nominal-v3");
+        job.addVariableDefinition("run", "5772");
+        job.addVariableDefinition("isMC", "true");
+        job.addInputFile(inputFile);
+        job.setup(steeringFile);
+        job.run();
+        System.out.println("Job with steering " + steeringFile + " successfully processed " + job.getLCSimLoop().getTotalCountableConsumed() + " events.");
+    }
+    
+    private void runDQM(File outputFile) {
+        System.out.println("Running DQM on " + outputFile.getPath() + " ...");
+        JobManager job = new JobManager();
+        File inputFile = new File(outputFile.getPath() + ".slcio");
+        job.addInputFile(inputFile);
+        job.addVariableDefinition("outputFile", outputFile.getPath().replace(".slcio", ""));
+        job.setup("/org/hps/steering/production/DataQualityRecon.lcsim");
+        job.run();
+        System.out.println("DQM processed " + job.getLCSimLoop().getTotalCountableConsumed() + " events from " + outputFile + ".");
+    }
+}
+
+

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/SimpleSvtReadoutTest.java	Mon Nov  2 05:55:03 2015
@@ -6,6 +6,7 @@
 
 import junit.framework.TestCase;
 
+import org.hps.data.test.TestDataUtility;
 import org.hps.job.JobManager;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
@@ -20,8 +21,7 @@
  *
  */
 public class SimpleSvtReadoutTest extends TestCase {
-
-    static final String fileUrl = "http://www.lcsim.org/test/hps-java/ReadoutToLcioTest.slcio";
+   
     static final File outputDir = new File("./target/test-output/" + SimpleSvtReadoutTest.class.getSimpleName());    
     static final File outputFile = new File(outputDir + File.separator + SimpleSvtReadoutTest.class.getSimpleName());
     
@@ -29,12 +29,9 @@
     static final String rawTrackerHitCollectionName = "SVTRawTrackerHits";
     
 	public void testSimpleSvtReadout() throws Exception { 
-		
-		this.printDebug("Retrieving test file from " + fileUrl);
-	
-        FileCache cache = new FileCache();
-        File inputFile = cache.getCachedFile(new URL(fileUrl));
-	        
+				
+		File inputFile = new TestDataUtility().getTestData("ReadoutToLcioTest.slcio");
+			        
         outputDir.mkdirs();
         if(!outputDir.exists()){ 
         	this.printDebug("Failed to create directory " + outputDir.getPath());

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use