001/* Run the Ptolemy model tests in the auto/ directory using cg code generation under JUnit. 002 003 Copyright (c) 2011-2016 The Regents of the University of California. 004 All rights reserved. 005 Permission is hereby granted, without written agreement and without 006 license or royalty fees, to use, copy, modify, and distribute this 007 software and its documentation for any purpose, provided that the above 008 copyright notice and the following two paragraphs appear in all copies 009 of this software. 010 011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 015 SUCH DAMAGE. 016 017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 022 ENHANCEMENTS, OR MODIFICATIONS. 023 024 PT_COPYRIGHT_VERSION_2 025 COPYRIGHTENDKEY 026 027 */ 028 029package ptolemy.util.test.junit; 030 031import org.junit.Before; 032import org.junit.Test; 033import org.junit.runner.RunWith; 034 035import junitparams.JUnitParamsRunner; 036import junitparams.Parameters; 037 038/////////////////////////////////////////////////////////////////// 039//// AutoCGCNoInlineTests 040 041/** 042 * Run the Ptolemy model tests in the auto/ directory using cg code generation 043 * under JUnit without inlining. 044 * 045 * <p> 046 * The DE codegen facility does not work with inlining. 047 * </p> 048 * 049 * <p> 050 * This test must be run from the directory that contains the auto/ directory, 051 * for example: 052 * </p> 053 * 054 * <pre> 055 * (cd ptolemy/cg/adapter/generic/program/procedural/c/adapters/ptolemy/actor/lib/test; java -classpath ${PTII}:${PTII}/lib/junit-4.8.2.jar:${PTII}/lib/JUnitParams-0.3.0.jar org.junit.runner.JUnitCore ptolemy.util.test.junit.AutoCGCTests) 056 * </pre> 057 * 058 * <p> 059 * This test uses JUnitParams from <a 060 * href="http://code.google.com/p/junitparams/#in_browser" 061 * >http://code.google.com/p/junitparams/</a>, which is released under <a 062 * href="http://www.apache.org/licenses/LICENSE-2.0#in_browser">Apache License 063 * 2.0</a>. 064 * </p> 065 * 066 * @author Christopher Brooks 067 * @version $Id$ 068 * @since Ptolemy II 10.0 069 * @Pt.ProposedRating Red (cxh) 070 * @Pt.AcceptedRating Red (cxh) 071 */ 072@RunWith(JUnitParamsRunner.class) 073public class AutoCGCNoInlineTests extends AutoCGTests { 074 075 /** 076 * Find the ptolemy.cg.kernel.generic.GenericCodeGenerator class and its generateCode static 077 * method that takes an array of strings. 078 * 079 * @exception Throwable 080 * If the class or constructor cannot be found. 081 */ 082 @Override 083 @Before 084 public void setUp() throws Throwable { 085 super.setUp(); 086 } 087 088 /** 089 * Generate, compile and run non-inline code for a model. 090 * 091 * @param fullPath The full path to the model file to be 092 * executed. If the fullPath ends with the value of the {@link 093 * #THERE_ARE_NO_AUTO_TESTS}, then the method returns 094 * immediately. 095 * @exception Throwable If thrown while executing the model. 096 */ 097 @Test 098 @Parameters(method = "modelValues") 099 public void runModelNoInline(String fullPath) throws Throwable { 100 runModel(fullPath, "c", false /* generateInSubdirectory */, 101 false /* inline */, 2500 /* maximumLinesPerBlock */, 102 false /*variablesAsArrays*/, "" /*generatorPackageList*/); 103 } 104}