forked from apache/storm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert (Bobby) Evans
committed
Jun 17, 2015
1 parent
f75cf7c
commit 8e2374f
Showing
10 changed files
with
215 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import sys | ||
import subprocess | ||
from datetime import datetime, timedelta | ||
|
||
def main(file, cmd): | ||
print cmd, "writing to", file | ||
out = open(file, "w") | ||
count = 0 | ||
process = subprocess.Popen(cmd, | ||
stderr=subprocess.STDOUT, | ||
stdout=subprocess.PIPE) | ||
|
||
start = datetime.now() | ||
nextPrint = datetime.now() + timedelta(seconds=1) | ||
# wait for the process to terminate | ||
pout = process.stdout | ||
line = pout.readline() | ||
while line: | ||
count = count + 1 | ||
if datetime.now() > nextPrint: | ||
diff = datetime.now() - start | ||
sys.stdout.write("\r%d seconds %d log lines"%(diff.seconds, count)) | ||
sys.stdout.flush() | ||
nextPrint = datetime.now() + timedelta(seconds=10) | ||
out.write(line) | ||
line = pout.readline() | ||
out.close() | ||
errcode = process.wait() | ||
diff = datetime.now() - start | ||
sys.stdout.write("\r%d seconds %d log lines"%(diff.seconds, count)) | ||
print cmd, "done", errcode | ||
return errcode | ||
|
||
if __name__ == "__main__": | ||
if sys.argv < 1: | ||
print "Usage: %s [file info]" % sys.argv[0] | ||
sys.exit(1) | ||
|
||
sys.exit(main(sys.argv[1], sys.argv[2:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
PYTHON_VERSION_TO_FILE=`python -V > /tmp/python_version 2>&1` | ||
PYTHON_VERSION=`cat /tmp/python_version` | ||
RUBY_VERSION=`ruby -v` | ||
NODEJS_VERSION=`node -v` | ||
|
||
echo "Python version : $PYTHON_VERSION" | ||
echo "Ruby version : $RUBY_VERSION" | ||
echo "NodeJs version : $NODEJS_VERSION" | ||
|
||
STORM_SRC_ROOT_DIR=$1 | ||
|
||
TRAVIS_SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
|
||
cd ${STORM_SRC_ROOT_DIR} | ||
|
||
python ${TRAVIS_SCRIPT_DIR}/save-logs.py "install.txt" mvn clean install -DskipTests -Pnative | ||
BUILD_RET_VAL=$? | ||
|
||
if [[ "$BUILD_RET_VAL" != "0" ]]; | ||
then | ||
cat "install.txt" | ||
fi | ||
|
||
exit ${BUILD_RET_VAL} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
;; Licensed to the Apache Software Foundation (ASF) under one | ||
;; or more contributor license agreements. See the NOTICE file | ||
;; distributed with this work for additional information | ||
;; regarding copyright ownership. The ASF licenses this file | ||
;; to you under the Apache License, Version 2.0 (the | ||
;; "License"); you may not use this file except in compliance | ||
;; with the License. You may obtain a copy of the License at | ||
;; | ||
;; http://www.apache.org/licenses/LICENSE-2.0 | ||
;; | ||
;; Unless required by applicable law or agreed to in writing, software | ||
;; distributed under the License is distributed on an "AS IS" BASIS, | ||
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
;; See the License for the specific language governing permissions and | ||
;; limitations under the License. | ||
|
||
(ns org.apache.storm.testrunner) | ||
|
||
(import `java.util.Properties) | ||
(import `java.io.ByteArrayOutputStream) | ||
(import `java.io.FileInputStream) | ||
(import `java.io.FileOutputStream) | ||
(import `java.io.FileWriter) | ||
(import `java.io.File) | ||
(import `java.io.OutputStream) | ||
(import `java.io.PrintStream) | ||
(import `java.io.PrintWriter) | ||
(use 'clojure.test) | ||
(use 'clojure.test.junit) | ||
|
||
(def props (Properties.)) | ||
(.load props (FileInputStream. (first *command-line-args*))) | ||
|
||
(def namespaces (into [] | ||
(for [[key val] props | ||
:when (.startsWith key "ns.")] | ||
(symbol val)))) | ||
|
||
(def output-dir (.get props "outputDir")) | ||
|
||
(dorun (for [ns namespaces] | ||
(require ns))) | ||
|
||
(.mkdirs (File. output-dir)) | ||
|
||
(let [sys-out System/out | ||
sys-err System/err | ||
num-bad (atom 0) | ||
original-junit-report junit-report | ||
cached-out (atom nil) | ||
test-error (atom 0) | ||
orig-out *out*] | ||
(dorun (for [ns namespaces] | ||
(with-open [writer (FileWriter. (str output-dir "/" ns ".xml")) | ||
out-stream (FileOutputStream. (str output-dir "/" ns "-output.txt")) | ||
out-writer (PrintStream. out-stream true)] | ||
(.println sys-out (str "Running " ns)) | ||
(try | ||
(System/setOut out-writer) | ||
(System/setErr out-writer) | ||
(binding [*test-out* writer | ||
*out* (PrintWriter. out-stream true) | ||
junit-report (fn [data] | ||
(let [type (data :type)] | ||
(cond | ||
(= type :begin-test-var) (do | ||
(reset! cached-out (ByteArrayOutputStream.)) | ||
(let [writer (PrintStream. @cached-out true)] | ||
(set! *out* (PrintWriter. @cached-out true)) | ||
(System/setOut writer) | ||
(System/setErr writer)) | ||
(reset! test-error 0)) | ||
(= type :end-test-var) (do | ||
(.write out-writer (.toByteArray @cached-out)) | ||
(when (> @test-error 0) | ||
(with-test-out | ||
(start-element 'system-out true) | ||
(element-content (String. (.toByteArray @cached-out))) | ||
(finish-element 'system-out true)))) | ||
(= type :fail) (swap! test-error inc) | ||
(= type :error) (swap! test-error inc))) | ||
(original-junit-report data))] | ||
(with-junit-output | ||
(let [result (run-tests ns)] | ||
(.println sys-out (str "Tests run: " (result :test) ", Passed: " (result :pass) ", Failures: " (result :fail) ", Errors: " (result :error))) | ||
(reset! num-bad (+ @num-bad (result :error) (result :fail)))))) | ||
(finally | ||
(System/setOut sys-out) | ||
(System/setErr sys-err)))))) | ||
(shutdown-agents) | ||
(System/exit (if (> @num-bad 0) 1 0))) |