Main.java revision ef7517d54854004ab8abe9ecffa39d720ec7b042
1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.google.coretests; 18 19import junit.textui.TestRunner; 20import tests.AllTests; 21 22/** 23 * Main class to run the core tests. 24 */ 25public class Main 26{ 27 public static void main(String[] args) { 28 if (args.length == 0) { 29 System.out.println("Running all tests..."); 30 TestRunner.run(AllTests.suite()); 31 } else if ("--stats".equals(args[0])) { 32 // Delegate to new stats test runner 33 String[] args2 = new String[args.length - 1]; 34 System.arraycopy(args, 1, args2, 0, args2.length); 35 36 if (args2.length == 0) { 37 System.out.println("Running all tests with stats..."); 38 StatTestRunner.run(AllTests.suite()); 39 } else { 40 System.out.println("Running selected tests with stats..."); 41 StatTestRunner.main(args2); 42 } 43 } else { 44 System.out.println("Running selected tests..."); 45 CoreTestRunner.main(args); 46 } 47 48 Runtime.getRuntime().halt(0); 49 } 50} 51