allow running stress from build classes patch by Vijay; reviewed by jbellis for CASSANDRA-4139
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1ef97386 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1ef97386 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1ef97386 Branch: refs/heads/trunk Commit: 1ef973867f555cc33ccf17a45fc5d67aef081b60 Parents: a6302d6 Author: Vijay Parthasarathy <vijay2...@gmail.com> Authored: Mon Apr 16 15:43:53 2012 -0700 Committer: Vijay Parthasarathy <vijay2...@gmail.com> Committed: Mon Apr 16 15:50:25 2012 -0700 ---------------------------------------------------------------------- build.xml | 23 +++++----- tools/bin/stress | 48 +++++++++++++++++++++ tools/bin/stress.bat | 31 ++++++++++++++ tools/bin/stressd | 84 ++++++++++++++++++++++++++++++++++++++ tools/stress/bin/stress | 37 ----------------- tools/stress/bin/stress.bat | 31 -------------- tools/stress/bin/stressd | 73 --------------------------------- 7 files changed, 175 insertions(+), 152 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/build.xml ---------------------------------------------------------------------- diff --git a/build.xml b/build.xml index ca83a0d..6ec0cde 100644 --- a/build.xml +++ b/build.xml @@ -655,7 +655,7 @@ The build target builds all the .class files --> <target name="build" - depends="maven-ant-tasks-retrieve-build,avro-generate,build-subprojects,build-project,stress-build" description="Compile Cassandra classes"/> + depends="maven-ant-tasks-retrieve-build,avro-generate,build-subprojects,build-project" description="Compile Cassandra classes"/> <target name="build-subprojects" description="Compile Cassandra contrib projects"/> <target name="codecoverage" depends="cobertura-instrument,test,cobertura-report" description="Create code coverage report"/> @@ -687,12 +687,12 @@ <!-- Stress build file --> <property name="stress.build.src" value="${basedir}/tools/stress/src" /> <property name="stress.build.classes" value="${build.classes}/stress" /> - <property name="stress.manifest" value="${basedir}/tools/stress/MANIFEST.MF" /> + <property name="stress.manifest" value="${stress.build.classes}/MANIFEST.MF" /> <path id="cassandra.classes"> <pathelement location="${basedir}/build/classes/main" /> <pathelement location="${basedir}/build/classes/thrift" /> </path> - <target name="stress-build"> + <target name="stress-build" depends="build"> <mkdir dir="${stress.build.classes}" /> <javac destdir="${stress.build.classes}" includeantruntime="true"> <src path="${stress.build.src}" /> @@ -780,8 +780,8 @@ <attribute name="Main-Class" value="org.apache.cassandra.stress.Stress"/> </manifest> <mkdir dir="${stress.build.classes}/META-INF" /> - <mkdir dir="${build.dir}/tools/stress" /> - <jar destfile="${build.dir}/tools/stress/stress.jar" manifest="${stress.manifest}"> + <mkdir dir="${build.dir}/tools/lib/" /> + <jar destfile="${build.dir}/tools/lib/stress.jar" manifest="${stress.manifest}"> <fileset dir="${stress.build.classes}"/> <fileset dir="${basedir}/build/classes/main" /> <fileset dir="${basedir}/build/classes/thrift" /> @@ -898,13 +898,13 @@ <include name="*.txt" /> </fileset> </copy> - <copy todir="${dist.dir}/tools/stress"> - <fileset dir="${basedir}/tools/stress"> - <include name="bin/**" /> + <copy todir="${dist.dir}/tools/bin"> + <fileset dir="${basedir}/tools/bin"/> + </copy> + <copy todir="${dist.dir}/tools/lib"> + <fileset dir="${build.dir}/tools/lib/"> + <include name="*.jar" /> </fileset> - <fileset dir="${build.dir}/tools/stress/"> - <include name="*.jar" /> - </fileset> </copy> <artifact:writepom pomRefId="dist-pom" file="${build.dir}/${final.name}-dist.pom"/> @@ -923,6 +923,7 @@ <!-- Executable scripts in bin/ --> <tarfileset dir="${dist.dir}" prefix="${final.name}" mode="755"> <include name="bin/*"/> + <include name="tools/bin/*"/> <not> <filename name="bin/*.in.sh" /> </not> http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/bin/stress ---------------------------------------------------------------------- diff --git a/tools/bin/stress b/tools/bin/stress new file mode 100644 index 0000000..8c8d22f --- /dev/null +++ b/tools/bin/stress @@ -0,0 +1,48 @@ +#!/bin/sh + +# 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. + +if [ "x$CLASSPATH" = "x" ]; then + + # execute from the build dir. + if [ -d `dirname $0`/../../build/classes ]; then + for directory in `dirname $0`/../../build/classes/*; do + CLASSPATH=$CLASSPATH:$directory + done + else + if [ -f `dirname $0`/../lib/stress.jar ]; then + CLASSPATH=`dirname $0`/../lib/stress.jar + fi + fi + + for jar in `dirname $0`/../../lib/*.jar; do + CLASSPATH=$CLASSPATH:$jar + done +fi + +if [ -x $JAVA_HOME/bin/java ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=`which java` +fi + +if [ "x$JAVA" = "x" ]; then + echo "Java executable not found (hint: set JAVA_HOME)" >&2 + exit 1 +fi + +$JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.Stress $@ http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/bin/stress.bat ---------------------------------------------------------------------- diff --git a/tools/bin/stress.bat b/tools/bin/stress.bat new file mode 100644 index 0000000..78e8dbb --- /dev/null +++ b/tools/bin/stress.bat @@ -0,0 +1,31 @@ +@REM Licensed to the Apache Software Foundation (ASF) under one or more +@REM contributor license agreements. See the NOTICE file distributed with +@REM this work for additional information regarding copyright ownership. +@REM The ASF licenses this file to You under the Apache License, Version 2.0 +@REM (the "License"); you may not use this file except in compliance with +@REM the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. + +@echo off + +if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\.. +if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD% + +set CLASSPATH="%STRESS_HOME%\..\lib\*.jar" +for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" + set CLASSPATH=%CLASSPATH%;"%%i" +goto start + +:append +set CLASSPATH=%CLASSPATH%;%1 +goto :eof + +:start +"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.stress.Stress %* http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/bin/stressd ---------------------------------------------------------------------- diff --git a/tools/bin/stressd b/tools/bin/stressd new file mode 100644 index 0000000..400ebb0 --- /dev/null +++ b/tools/bin/stressd @@ -0,0 +1,84 @@ +#!/bin/sh + +# 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. + +DESC="Stress Test Daemon" + +if [ "x$CLASSPATH" = "x" ]; then + + # execute from the build dir. + if [ -d `dirname $0`/../../build/classes ]; then + for directory in `dirname $0`/../../build/classes/*; do + CLASSPATH=$CLASSPATH:$directory + done + else + if [ -f `dirname $0`/../lib/stress.jar ]; then + CLASSPATH=`dirname $0`/../lib/stress.jar + fi + fi + + for jar in `dirname $0`/../../lib/*.jar; do + CLASSPATH=$CLASSPATH:$jar + done +fi + +if [ -x $JAVA_HOME/bin/java ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=`which java` +fi + +if [ "x$JAVA" = "x" ]; then + echo "Java executable not found (hint: set JAVA_HOME)" >&2 + exit 1 +fi + +case "$1" in + start) + echo "Starting $DESC: " + $JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log & + echo $! > ./stressd.pid + echo "done." + ;; + + stop) + PID=`cat ./stressd.pid 2> /dev/null` + + if [ "x$PID" = "x" ]; then + echo "$DESC is not running." + else + kill -9 $PID + rm ./stressd.pid + echo "$DESC is stopped." + fi + ;; + + status) + PID=`cat ./stressd.pid 2> /dev/null` + + if [ "x$PID" = "x" ]; then + echo "$DESC is not running." + else + echo "$DESC is running with pid $PID." + fi + ;; + + *) + echo "Usage: $0 start|stop|status [-h <host>]" + ;; +esac + http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/stress/bin/stress ---------------------------------------------------------------------- diff --git a/tools/stress/bin/stress b/tools/stress/bin/stress deleted file mode 100755 index 811e3d7..0000000 --- a/tools/stress/bin/stress +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# 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. - -if [ "x$CLASSPATH" = "x" ]; then - CLASSPATH=`dirname $0`/../stress.jar - for jar in `dirname $0`/../../../lib/*.jar; do - CLASSPATH=$CLASSPATH:$jar - done -fi - -if [ -x $JAVA_HOME/bin/java ]; then - JAVA=$JAVA_HOME/bin/java -else - JAVA=`which java` -fi - -if [ "x$JAVA" = "x" ]; then - echo "Java executable not found (hint: set JAVA_HOME)" >&2 - exit 1 -fi - -$JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.Stress $@ http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/stress/bin/stress.bat ---------------------------------------------------------------------- diff --git a/tools/stress/bin/stress.bat b/tools/stress/bin/stress.bat deleted file mode 100644 index 0373125..0000000 --- a/tools/stress/bin/stress.bat +++ /dev/null @@ -1,31 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\.. -if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD% - -set CLASSPATH="%STRESS_HOME%\..\*.jar" -for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" - set CLASSPATH=%CLASSPATH%;"%%i" -goto start - -:append -set CLASSPATH=%CLASSPATH%;%1 -goto :eof - -:start -"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.stress.Stress %* http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ef97386/tools/stress/bin/stressd ---------------------------------------------------------------------- diff --git a/tools/stress/bin/stressd b/tools/stress/bin/stressd deleted file mode 100755 index b7ff6f5..0000000 --- a/tools/stress/bin/stressd +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -# 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. - -DESC="Stress Test Daemon" - -if [ "x$CLASSPATH" = "x" ]; then - CLASSPATH=`dirname $0`/../stress.jar - for jar in `dirname $0`/../../../lib/*.jar; do - CLASSPATH=$CLASSPATH:$jar - done -fi - -if [ -x $JAVA_HOME/bin/java ]; then - JAVA=$JAVA_HOME/bin/java -else - JAVA=`which java` -fi - -if [ "x$JAVA" = "x" ]; then - echo "Java executable not found (hint: set JAVA_HOME)" >&2 - exit 1 -fi - -case "$1" in - start) - echo "Starting $DESC: " - $JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log & - echo $! > ./stressd.pid - echo "done." - ;; - - stop) - PID=`cat ./stressd.pid 2> /dev/null` - - if [ "x$PID" = "x" ]; then - echo "$DESC is not running." - else - kill -9 $PID - rm ./stressd.pid - echo "$DESC is stopped." - fi - ;; - - status) - PID=`cat ./stressd.pid 2> /dev/null` - - if [ "x$PID" = "x" ]; then - echo "$DESC is not running." - else - echo "$DESC is running with pid $PID." - fi - ;; - - *) - echo "Usage: $0 start|stop|status [-h <host>]" - ;; -esac -