Changeset 3898

Show
Ignore:
Timestamp:
06/26/09 23:19:55 (8 months ago)
Author:
sukyoungryu
Message:

[tests] Refactored the test harness to handle any Fortress shell commands.

Location:
trunk
Files:
2 added
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/not_working_static_tests/DXXGeneralizedIf.fss

    r3258 r3898  
    11(******************************************************************************* 
    2     Copyright 2008 Sun Microsystems, Inc., 
     2    Copyright 2009 Sun Microsystems, Inc., 
    33    4150 Network Circle, Santa Clara, California 95054, U.S.A. 
    44    All rights reserved. 
  • trunk/ProjectFortress/not_working_static_tests/DXXVoidTest.fss

    r2111 r3898  
    11(******************************************************************************* 
    2     Copyright 2008 Sun Microsystems, Inc., 
     2    Copyright 2009 Sun Microsystems, Inc., 
    33    4150 Network Circle, Santa Clara, California 95054, U.S.A. 
    44    All rights reserved. 
  • trunk/ProjectFortress/src/com/sun/fortress/tests/unit_tests/FileTests.java

    r3886 r3898  
    6161        else return dir + "/" + file; 
    6262    } 
    63      
     63 
    6464    public static class BaseTest extends TestCase { 
    6565        /** 
     
    457457 
    458458        static boolean whinedAboutTimingIssues = false; 
    459          
     459 
    460460        public void testFile() throws Throwable { 
    461461            String scriptName = ProjectProperties.FORTRESS_AUTOHOME 
     
    485485                env.put("FORTRESS_HOME", ProjectProperties.FORTRESS_AUTOHOME); 
    486486            } 
    487              
     487 
    488488            long start_time = System.currentTimeMillis(); 
    489              
     489 
    490490            Process p = pb.start(); 
    491491            InputStream err = p.getErrorStream(); 
     
    503503            f_err.join(); 
    504504            int exitValue = p.waitFor(); 
    505              
     505 
    506506            long stop_time = System.currentTimeMillis(); 
    507              
     507 
    508508            String s_out = cached_out.toString(); 
    509509            String s_err = cached_err.toString(); 
     
    543543                       // do nothing 
    544544                    } else { 
    545                       
     545 
    546546 
    547547                        int timeLimit = tprops.getInt(whoami, -1); 
     
    567567                } 
    568568            } 
    569              
     569 
    570570            // OY, pass/fail dsylexia here. 
    571571 
     
    662662    } 
    663663 
    664     public static class CompileTest extends SourceFileTest { 
    665  
     664    public static class CommandTest extends SourceFileTest { 
     665        private final String command; 
    666666        private final StringMap props; 
    667 //        public CompileTest(StringMap props, String path, String d, String s, 
    668 //                boolean unexpected_only, boolean knownFailure) { 
    669 //            super(path, d, s, unexpected_only, knownFailure, s.startsWith("XXX") ); 
    670 //            this.props = props; 
    671 //        } 
    672         public CompileTest(StringMap props, String path, String d, String s, 
     667        public CommandTest(String command, StringMap props, String path, String d, String s, 
    673668                           boolean unexpected_only, boolean knownFailure, boolean shouldFail) { 
    674669            super(path, d, s, unexpected_only, knownFailure, shouldFail ); 
     670            this.command = command; 
    675671            this.props = props; 
    676672        } 
     
    679675        protected int justTheTest() 
    680676                throws FileNotFoundException, IOException, Throwable { 
    681             String[] tokens = new String [] {"compile", join(dir, makeTestFileName(name))}; 
     677            String[] tokens = new String [] {command, join(dir, makeTestFileName(name))}; 
    682678            int rc = com.sun.fortress.Shell.subMain(tokens); 
    683679            return rc; 
     
    688684        public String tag() { 
    689685            // TODO Auto-generated method stub 
    690             return "compile"; 
     686            return command; 
    691687        } 
    692688 
    693689        public  String testFailed(String out, String err, String exc) { 
    694             return generalTestFailed("compile_", props, out, err, exc); 
    695         } 
    696  
    697     } 
    698  
    699     public static class DesugarTest extends SourceFileTest { 
    700  
    701         private final StringMap props; 
    702         public DesugarTest(StringMap props, String path, String d, String s, 
    703                            boolean unexpected_only, boolean knownFailure, boolean shouldFail) { 
    704             super(path, d, s, unexpected_only, knownFailure, shouldFail ); 
    705             this.props = props; 
    706  
    707         } 
    708  
    709         @Override 
    710         protected int justTheTest() 
    711             throws FileNotFoundException, IOException, Throwable { 
    712             // might need to strip the .fss off f "f". 
    713             String[] tokens = new String [] {"desugar", join(dir, makeTestFileName(name))}; 
    714             int rc = com.sun.fortress.Shell.subMain(tokens); 
    715             return rc; 
    716         } 
    717  
    718         @Override 
    719         public String tag() { 
    720             // TODO Auto-generated method stub 
    721             return "desugar"; 
    722         } 
    723  
    724         public  String testFailed(String out, String err, String exc) { 
    725             return generalTestFailed("desugar_", props, out, err, exc); 
    726         } 
    727  
    728     } 
    729  
    730     public static class LinkTest extends SourceFileTest { 
    731  
    732         private final StringMap props; 
    733        public LinkTest(StringMap props, String path, String d, String s, 
    734                 boolean unexpected_only, boolean knownFailure, boolean shouldFail) { 
    735             super(path, d, s, unexpected_only, knownFailure, shouldFail ); 
    736             this.props = props; 
    737  
    738         } 
    739  
    740         @Override 
    741         protected int justTheTest() 
    742                 throws FileNotFoundException, IOException, Throwable { 
    743             // might need to strip the .fss off f "f". 
    744             String[] tokens = new String [] {"link", join(dir, makeTestFileName(name))}; 
    745             int rc = com.sun.fortress.Shell.subMain(tokens); 
    746             return rc; 
    747         } 
    748  
    749         @Override 
    750         public String tag() { 
    751             // TODO Auto-generated method stub 
    752             return "link"; 
    753         } 
    754  
    755         public  String testFailed(String out, String err, String exc) { 
    756             return generalTestFailed("link_", props, out, err, exc); 
    757  
     690            return generalTestFailed(command + "_", props, out, err, exc); 
    758691        } 
    759692 
     
    940873        }; 
    941874 
    942         List<Test> compileTests = new ArrayList<Test>(); 
    943         List<Test> desugarTests = new ArrayList<Test>(); 
    944         List<Test> linkTests = new ArrayList<Test>(); 
     875        List<Test> commandTests = new ArrayList<Test>(); 
    945876        List<Test> runTests = new ArrayList<Test>(); 
    946877 
     
    955886                      directoryAsFile(dir_name_slashes_normalized).getCanonicalPath(); 
    956887              } 
    957              
    958              
     888 
     889 
    959890              if (i <= 0) { 
    960891                  System.out.println("Early testing exit after " + testCount + " tests"); 
     
    992923                                  standardCompilerTests(props, dir_name_canonical, dir_name_slashes_normalized, token, 
    993924                                                        expect_failure, shouldFail, failsOnly, 
    994                                                         compileTests, desugarTests, 
    995                                                         linkTests, runTests); 
     925                                                        commandTests, runTests); 
    996926                          } 
    997927                      } 
     
    999929                              standardCompilerTests(props, dir_name_canonical, dir_name_slashes_normalized, testname, 
    1000930                                                    expect_failure, shouldFail, failsOnly, 
    1001                                                     compileTests, desugarTests, 
    1002                                                     linkTests, runTests); 
     931                                                    commandTests, runTests); 
    1003932                      } 
    1004933                  } else { 
     
    1015944        // Do all the larger tests 
    1016945        if (i > 0) { 
    1017             for (Test test: compileTests) 
    1018                 suite.addTest(test); 
    1019  
    1020             for (Test test: desugarTests) 
    1021                 suite.addTest(test); 
    1022  
    1023             for (Test test: linkTests) 
     946            for (Test test: commandTests) 
    1024947                suite.addTest(test); 
    1025948 
     
    1038961     * @param shouldFail Test passes, if it fails (e.g., is an error printed?) 
    1039962     * @param failsOnly 
    1040      * @param compileTests 
    1041      * @param desugarTests 
    1042      * @param linkTests 
     963     * @param commandTests 
    1043964     * @param runTests 
    1044965     * @throws IOException 
     
    1049970                                              boolean shouldFail, 
    1050971                                              boolean failsOnly, 
    1051                                               List<Test> compileTests, 
    1052                                               List<Test> desugarTests, 
    1053                                               List<Test> linkTests, 
     972                                              List<Test> commandTests, 
    1054973                                              List<Test> runTests) throws IOException { 
     974        String[] commands = new String [] {"compile", "desugar", "link", "run", "api", 
     975                                           "parse", "disambiguate", "grammar", "typecheck", 
     976                                           "unparse", "compare", "build", 
     977                                           "fss", "fsi"}; 
     978 
    1055979        if (props.get("compile") != null) 
    1056             compileTests.add(new CompileTest(props, canonicalDirName, 
     980            commandTests.add(new CommandTest("compile", props, canonicalDirName, 
    1057981                                             dirname, testname, failsOnly, 
    1058982                                             expect_not_passing, shouldFail)); 
    1059983        if (props.get("desugar") != null) 
    1060             desugarTests.add(new DesugarTest(props, canonicalDirName, 
     984            commandTests.add(new CommandTest("desugar", props, canonicalDirName, 
    1061985                                             dirname, testname, failsOnly, 
    1062986                                             expect_not_passing, shouldFail)); 
    1063987        if (props.get("link") != null) 
    1064             linkTests.add(new LinkTest(props, canonicalDirName, 
    1065                                        dirname, testname, failsOnly, 
    1066                                        expect_not_passing, shouldFail)); 
     988            commandTests.add(new CommandTest("link", props, canonicalDirName, 
     989                                          dirname, testname, failsOnly, 
     990                                          expect_not_passing, shouldFail)); 
     991 
     992        if (props.get("api") != null) 
     993            runTests.add(new CommandTest("api", props, canonicalDirName, 
     994                                      dirname, testname, failsOnly, 
     995                                      expect_not_passing, shouldFail)); 
     996 
    1067997        if (props.get("run") != null) 
    1068998            runTests.add(new TestTest(props, canonicalDirName, 
    1069999                                      dirname, testname, failsOnly, 
    10701000                                      expect_not_passing, shouldFail)); 
     1001 
     1002        boolean found = false; 
     1003        for ( String c : new ArrayList<String>(java.util.Arrays.asList(commands)) ) { 
     1004            if (props.get(c) != null) found = true; 
     1005        } 
     1006 
     1007        if (! found) 
     1008            System.out.println("Not supported " + dirname + "/" + testname); 
    10711009    } 
    10721010 
  • trunk/bin/copyrightCheck.pl

    r3887 r3898  
    3939my $copyright = "Copyright $checkDate "; # The message to look for. 
    4040my $maxlines = 10;       # The message must appear within this many lines of the top of the file. 
    41 my $ignoreThese = 'ant|fortress-keywords|UserDictionary|README.txt|README$|\.fsg$|\.NW$|fortress.vim|\.ods|\.jar$|\.timing$|\.war$|\.zip$|\.tgz$|\/\.|^\.|^Sandbox'; 
     41my $ignoreThese = 'ant|fortress-keywords|UserDictionary|README.txt|README$|\.fsg$|\.NW$|fortress.vim|\.ods|\.jar$|\.tic$|\.timing$|\.war$|\.zip$|\.tgz$|\/\.|^\.|^Sandbox'; 
    4242my $tempFile = '/tmp/svnInfo.xml'; 
    4343 
  • trunk/bin/fortick

    r3897 r3898  
    22 
    33################################################################################ 
    4 #    Copyright 2008 Sun Microsystems, Inc., 
     4#    Copyright 2009 Sun Microsystems, Inc., 
    55#    4150 Network Circle, Santa Clara, California 95054, U.S.A. 
    66#    All rights reserved.