2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.distribution;
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.io.OutputStream;
14 import java.util.ArrayList;
15 import java.util.List;
19 static void copy(InputStream in, OutputStream out) throws IOException {
27 public static void main(String[] args) throws IOException, InterruptedException {
28 String cwd = System.getProperty("user.dir");
30 System.out.println("Current working directory = " + cwd);
32 String os = System.getProperty("os.name").toLowerCase();
33 List<String> script = new ArrayList<String>();
35 if(os.contains("windows")){
36 script.add("cmd.exe");
38 script.add("runsanity.bat");
40 script.add("./runsanity.sh");
43 ProcessBuilder processBuilder = new ProcessBuilder();
44 processBuilder.inheritIO().command(script);
45 Process p = processBuilder.start();
47 copy(p.getInputStream(), System.out);
51 System.out.println("Test exited with exitValue = " + p.exitValue());
53 System.exit(p.exitValue());