You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2007/06/08 18:35:10 UTC
svn commit: r545554 [2/13] - in
/harmony/enhanced/buildtest/branches/2.0/tests/reliability: ./ run/ src/
src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/harmony/
src/java/org/apache/harmony/test/ src/java/org/apache/harmony/test/reliab...
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.normal.mode.settings.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.normal.mode.settings.xml?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.normal.mode.settings.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.normal.mode.settings.xml Fri Jun 8 09:34:52 2007
@@ -0,0 +1,549 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<project name="run.normal.mode.settings">
+
+ <description>Set of properties/test parameters for reliability tests</description>
+
+
+<!-- api.kernel.args.AppVMCLParamTest -->
+
+ <!-- maximum number of application parameters passed to exec()-ed java appplication,
+ muliplied by 10 - is a maximum size of one parameter (number of chars in one parameter).
+ -->
+ <property name="api.kernel.args.AppVMCLParamTest.max_n_app_params" value="2" />
+
+ <!-- VM oprtions with which to start application, ":" is a separator -->
+ <property name="api.kernel.args.AppVMCLParamTest.vm_opts" value=":-Xmx256m:-Xms128m" />
+
+<!-- api.kernel.args.ExecEnvTest -->
+
+ <!-- maximum number of environment variables passed to exec(), muliplied by
+ 10 is a maximum size of one variable value (number of chars in one variable). -->
+ <property name="api.kernel.args.ExecEnvTest.max_n_env_vars" value="2" />
+
+<!-- api.kernel.args.VMCLPropertiesTest -->
+
+ <!-- maximum number of runtime properties passed to exec()-ed runtime, muliplied by
+ 10 is a maximum size of one property (number of chars in one property). -->
+ <property name="api.kernel.args.VMCLPropertiesTest.max_n_properties" value="2" />
+
+ <!-- VM oprtions with which start application, ":" is a separator -->
+ <property name="api.kernel.args.VMCLPropertiesTest.prop_test_vm_opts" value=":-Xmx256m:-Xms128m" />
+
+<!-- api.kernel.exec.RunExec -->
+
+ <!-- the number of simultaneously executed runtime.exec() -->
+ <property name="api.kernel.exec.RunExec.num_execs" value="5" />
+
+ <!-- number of threads in each exec()-ed application -->
+ <property name="api.kernel.exec.RunExec.num_threads" value="2" />
+
+<!-- api.kernel.hooks.AddRmPropertiesHooksTest -->
+
+ <!-- the number of properties to set/get/remove -->
+ <property name="api.kernel.hooks.AddRmPropertiesHooksTest.n_properties" value="1000" />
+
+ <!-- number of hooks to add/remove -->
+ <property name="api.kernel.hooks.AddRmPropertiesHooksTest.n_hooks" value="100" />
+
+<!-- api.kernel.object.ObjectCloneTest -->
+
+ <!-- number of iterations to call/initialize in a cycle in one iteration
+ and number of clones -->
+ <property name="api.kernel.object.ObjectCloneTest.n_iterations" value="1000" />
+
+<!-- api.kernel.object.ObjectFinalizeTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.kernel.object.ObjectFinalizeTest.n_iterations" value="10000" />
+
+<!-- api.kernel.object.ObjectGetclassHashcodeTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.kernel.object.ObjectGetclassHashcodeTest.n_iterations" value="10000" />
+
+<!-- api.kernel.pckg.PackageGetTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.kernel.pckg.PackageGetTest.n_iterations" value="10000" />
+
+<!-- api.kernel.thread.Calculation.CalcTest -->
+
+ <!-- number of tasks which calculate factorial -->
+ <property name="api.kernel.thread.Calculation.CalcTest.tasks" value="20" />
+
+ <!-- argument factorial function -->
+ <property name="api.kernel.thread.Calculation.CalcTest.depth" value="10" />
+
+<!-- api.kernel.thread.ThreadSuspendResume.ThreadSuspendResume -->
+
+ <!-- number of threads to start in test -->
+ <property name="api.kernel.thread.ThreadSuspendResume.ThreadSuspendResume.n_threads" value="30" />
+
+ <!-- number of suspend/resum iterations -->
+ <property name="api.kernel.thread.ThreadSuspendResume.ThreadSuspendResume.n_iters" value="20" />
+
+<!-- api.kernel.management.SystemResourceOrientedTest -->
+
+ <!-- number of threads to start in test -->
+ <property name="api.kernel.management.SystemResourceOrientedTest.n_threads" value="30" />
+
+ <!-- number of iterations -->
+ <property name="api.kernel.management.SystemResourceOrientedTest.n_iters" value="20" />
+
+ <!-- number of iterations -->
+ <property name="api.kernel.management.SystemResourceOrientedTest.n_loadedClasses" value="1000" />
+
+<!-- api.kernel.thread.LifeSimulationTest.Life -->
+
+ <property name="api.kernel.thread.LifeSimulationTest.Life.max_creatures" value="100" />
+ <property name="api.kernel.thread.LifeSimulationTest.Life.max_age" value="100" />
+ <property name="api.kernel.thread.LifeSimulationTest.Life.start_health" value="100" />
+ <property name="api.kernel.thread.LifeSimulationTest.Life.total_food" value="10000" />
+
+<!-- api.kernel.thread.RecursiveThreadTest.RecursiveTest -->
+
+ <!-- depth of recursion of threads -->
+ <property name="api.kernel.thread.RecursiveThreadTest.RecursiveTest.recursion_depth" value="100" />
+
+ <!-- size of Object array for each thread -->
+ <property name="api.kernel.thread.RecursiveThreadTest.RecursiveTest.array_size" value="1000" />
+
+<!-- api.kernel.thread.Synchronization.SynchroTest -->
+
+ <!-- number of iterations to run each thread -->
+ <property name="api.kernel.thread.Synchronization.SynchroTest.iterations" value="10" />
+
+<!-- api.kernel.thread.Synchronization.SynchroTest2 -->
+
+ <!-- number of threads -->
+ <property name="api.kernel.thread.Synchronization.SynchroTest2.threads" value="25" />
+
+ <!-- length of series -->
+ <property name="api.kernel.thread.Synchronization.SynchroTest2.serial" value="5" />
+
+<!-- api.kernel.thread.ThreadArrayTest.ThreadArrayTest -->
+
+ <!-- number of threads -->
+ <property name="api.kernel.thread.ThreadArrayTest.ThreadArrayTest.threads" value="20" />
+
+ <!-- how times each thread starts -->
+ <property name="api.kernel.thread.ThreadArrayTest.ThreadArrayTest.starts" value="200" />
+
+
+<!-- api.kernel.thread.ThreadKill.ThreadKillTest -->
+
+ <!-- number of threads -->
+ <property name="api.kernel.thread.ThreadKill.ThreadKillTest.threads" value="50" />
+
+ <!-- number of internal iterations/cycles -->
+ <property name="api.kernel.thread.ThreadKill.ThreadKillTest.iterations" value="10" />
+
+<!-- api.kernel.thread.VolatileVariableTest.DekkerTest -->
+
+ <!-- number of iterations to run critical region in each thread -->
+ <property name="api.kernel.thread.VolatileVariableTest.DekkerTest.iterations" value="20" />
+
+<!-- api.kernel.thread.VolatileVariableTest.PetersonTest -->
+
+ <!-- number of iterations to run critical region in each thread -->
+ <property name="api.kernel.thread.VolatileVariableTest.PetersonTest.iterations" value="20" />
+
+<!-- api.kernel.thread.WeakReferenceandThreadTest.WeakReferenceandThreadTest -->
+
+ <!-- number of starting threads -->
+ <property name="api.kernel.thread.WeakReferenceandThreadTest.WeakReferenceandThreadTest.threads" value="50" />
+
+ <!-- number of attemps to call GC -->
+ <property name="api.kernel.thread.WeakReferenceandThreadTest.WeakReferenceandThreadTest.gc_attempts" value="20" />
+
+
+<!-- api.zip.ZipEntryIterateThreadingTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.zip.ZipEntryIterateThreadingTest.n_threads" value="100" />
+
+
+<!-- api.zip.AdlerCRC32Test -->
+
+ <!-- number of internal iterations -->
+ <property name="api.zip.AdlerCRC32Test.iterations" value="10" />
+
+ <!-- byte arrays size to update Adler32 with -->
+ <property name="api.zip.AdlerCRC32Test.buf_size" value="10000" />
+
+<!-- api.zip.GZipInOutStreamTest -->
+
+ <!-- number of GZIPOutputStreams to write successively into one FileOutputStream -->
+ <property name="api.zip.GZipInOutStreamTest.n_entries" value="5" />
+
+<!-- api.zip.InflDeflGetResetTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.zip.InflDeflGetResetTest.iterations" value="5" />
+
+ <!-- maximum byte array size to deflate/inflate -->
+ <property name="api.zip.InflDeflGetResetTest.buf_size" value="10000" />
+
+<!-- api.zip.ZipInOutStreamTest -->
+
+ <!-- number of nesting zip entry -->
+ <property name="api.zip.ZipInOutStreamTest.n_entries" value="5" />
+
+<!-- api.zip.ZlibDeflaterTest -->
+
+ <!-- number of iterations to call/initialize a new compressor in a cycle -->
+ <property name="api.zip.ZlibDeflaterTest.iterations" value="500" />
+
+<!-- api.zip.ZlibDefsetDictionaryTest -->
+
+ <!-- number of iterations to call/initialize a preset dictionary
+ for compression in a cycle -->
+ <property name="api.zip.ZlibDefsetDictionaryTest.iterations" value="100" />
+
+<!-- api.zip.ZlibTest -->
+
+ <!-- number of deflating/inflating threads to run in parallel -->
+ <property name="api.zip.ZlibTest.n_threads" value="10" />
+
+ <!-- number of bytes to read from the file -->
+ <property name="api.zip.ZlibTest.n_bytes" value="30000" />
+
+ <!-- number of deflating/inflating iterations each thread does -->
+ <property name="api.zip.ZlibTest.iterations" value="10" />
+
+<!-- api.zip.ZlibTestStrategyLevel -->
+
+ <!-- size of byte buffer to initialize for Delfation/Inflation -->
+ <property name="api.zip.ZlibTestStrategyLevel.buf_size" value="1024" />
+
+<!-- api.zip.ZlibTestVariableLength -->
+
+ <!-- size of byte buffer to initialize for Delfation/Inflation -->
+ <property name="api.zip.ZlibTestVariableLength.buf_size" value="100000" />
+
+ <!-- number of internal Deflate/Inflate iterations -->
+ <property name="api.zip.ZlibTestVariableLength.iterations" value="10" />
+
+<!-- api.utilConcurrentTest -->
+
+ <!-- number of threads to start -->
+ <property name="api.util.ConcurrentTest.n_entries" value="30" />
+
+<!-- api.text.BreakIterator_AllLocales -->
+
+ <!-- number of internal iterations -->
+ <property name="api.text.BreakIterator_AllLocales.iterations" value="5" />
+
+<!-- api.text.CollationElementIteratorTest -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.CollationElementIteratorTest.n_threads" value="10" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.CollationElementIteratorTest.iterations" value="5" />
+
+<!-- api.text.CollationKeyTest_ArrHash -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.CollationKeyTest_ArrHash.n_threads" value="5" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.CollationKeyTest_ArrHash.iterations" value="5" />
+
+<!-- api.text.CollationKeyTest -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.CollationKeyTest.n_threads" value="10" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.CollationKeyTest.iterations" value="10" />
+
+<!-- api.text.DecimalFormat_Locales -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.DecimalFormat_Locales.n_threads" value="5" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.DecimalFormat_Locales.iterations" value="5" />
+
+<!-- api.text.getAvailableLocales_Coll -->
+
+ <!-- number of internal iterations -->
+ <property name="api.text.getAvailableLocales_Coll.iterations" value="20" />
+
+<!-- api.text.getAvailableLocals_RBC -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.getAvailableLocals_RBC.n_threads" value="2" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.getAvailableLocals_RBC.iterations" value="2" />
+
+<!-- api.text.getSentenceInstance_check -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.getSentenceInstance_check.n_threads" value="20" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.getSentenceInstance_check.iterations" value="20" />
+
+<!-- api.text.getSentenceInstance -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.text.getSentenceInstance.n_threads" value="20" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.text.getSentenceInstance.iterations" value="20" />
+
+<!-- api.nio.charset.CharsetSyncCacheTest -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.nio.charset.CharsetSyncCacheTest.n_threads" value="20" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.nio.charset.CharsetSyncCacheTest.iterations" value="5" />
+
+<!-- api.nio.charset.ContainsTest -->
+
+ <!-- number of iterations in each thread -->
+ <property name="api.nio.charset.ContainsTest.iterations" value="10" />
+
+<!-- api.nio.charset.DecodingModesTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.charset.DecodingModesTest.iterations" value="10" />
+
+<!-- api.nio.charset.EncDecTest -->
+
+ <!-- number of threads to be run in parallel -->
+ <property name="api.nio.charset.EncDecTest.n_threads" value="1" />
+
+ <!-- number of iterations in each thread -->
+ <property name="api.nio.charset.EncDecTest.iterations" value="1" />
+
+<!-- api.nio.charset.EncodingModesTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.charset.EncodingModesTest.iterations" value="2" />
+
+<!-- api.nio.charset.WrongCharsetNameTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.charset.WrongCharsetNameTest.iterations" value="5" />
+
+<!-- api.nio.channels.filechannel.ChannelWriteTest -->
+
+ <!-- number of threads to run in parallel -->
+ <property name="api.nio.channels.filechannel.ChannelWriteTest.n_threads" value="10" />
+
+ <!-- size of each byte buffer -->
+ <property name="api.nio.channels.filechannel.ChannelWriteTest.buffer_size" value="1000" />
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.channels.filechannel.ChannelWriteTest.iterations" value="10" />
+
+ <!-- size of ByteBuffer array to write in single write(ByteBuffer[]) -->
+ <property name="api.nio.channels.filechannel.ChannelWriteTest.n_buffers" value="100" />
+
+<!-- api.nio.channels.filechannel.FileChannelMapTest -->
+
+ <!-- number of threads to run in parallel -->
+ <property name="api.nio.channels.filechannel.FileChannelMapTest.n_threads" value="30" />
+
+ <!-- byte offset within the Test.out file to begin mapping from -->
+ <property name="api.nio.channels.filechannel.FileChannelMapTest.offset" value="512" />
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.channels.filechannel.FileChannelMapTest.iterations" value="50" />
+
+
+<!-- api.nio.channels.filechannel.MappedByteBufferForceTest -->
+
+ <!-- number of threads to run in parallel -->
+ <property name="api.nio.channels.filechannel.MappedByteBufferForceTest.n_threads" value="10" />
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.channels.filechannel.MappedByteBufferForceTest.iterations" value="10" />
+
+<!-- api.nio.buffers.ByteBufferallocateDirectTest -->
+
+ <!-- number of internal direct byte buffer allocate iterations -->
+ <property name="api.nio.buffers.ByteBufferallocateDirectTest.iterations" value="300" />
+
+ <!-- byte buffer size to allocate directly -->
+ <property name="api.nio.buffers.ByteBufferallocateDirectTest.buffer_size" value="10000" />
+
+<!-- api.nio.buffers.ByteBufferallocateTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.ByteBufferallocateTest.iterations" value="10" />
+
+ <!-- byte buffer size -->
+ <property name="api.nio.buffers.ByteBufferallocateTest.buffer_size" value="20000" />
+
+<!-- api.nio.buffers.ByteBufferCompactTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.ByteBufferCompactTest.iterations" value="200" />
+
+<!-- api.nio.buffers.ByteBufferPutBufferTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.ByteBufferPutBufferTest.iterations" value="100" />
+
+ <!-- byte buffer size -->
+ <property name="api.nio.buffers.ByteBufferPutBufferTest.buffer_size" value="20000" />
+
+<!-- api.nio.buffers.CharBufferSliceTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.CharBufferSliceTest.iterations" value="200" />
+
+<!-- api.nio.buffers.CharBufferWrapGetTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.CharBufferWrapGetTest.iterations" value="200" />
+
+<!-- api.nio.buffers.CharBufferWrapTest -->
+
+ <!-- number of internal iterations -->
+ <property name="api.nio.buffers.CharBufferWrapTest.iterations" value="200" />
+
+<!-- api.nio.buffers.DoubleBufferWrapGetTest -->
+
+ <!-- number of iterations to call/initialize one wrap/put/get in a cycle -->
+ <property name="api.nio.buffers.DoubleBufferWrapGetTest.iterations" value="100" />
+
+ <!-- size of allocated buffer -->
+ <property name="api.nio.buffers.DoubleBufferWrapGetTest.buffer_size" value="200" />
+
+<!-- api.nio.buffers.FloatBufferWrapGetTest -->
+
+ <!-- number of iterations to call/initialize one wrap/put/get in a cycle -->
+ <property name="api.nio.buffers.FloatBufferWrapGetTest.iterations" value="100" />
+
+ <!-- size of allocated buffer -->
+ <property name="api.nio.buffers.FloatBufferWrapGetTest.buffer_size" value="200" />
+
+<!-- api.nio.buffers.IntBufferWrapGetTest -->
+
+ <!-- number of iterations to call/initialize one wrap/put/get in a cycle -->
+ <property name="api.nio.buffers.IntBufferWrapGetTest.iterations" value="100" />
+
+ <!-- size of allocated buffer -->
+ <property name="api.nio.buffers.IntBufferWrapGetTest.buffer_size" value="200" />
+
+<!-- api.nio.buffers.LongBufferWrapGetTest -->
+
+ <!-- number of iterations to call/initialize one wrap/put/get in a cycle -->
+ <property name="api.nio.buffers.LongBufferWrapGetTest.iterations" value="100" />
+
+ <!-- size of allocated buffer -->
+ <property name="api.nio.buffers.LongBufferWrapGetTest.buffer_size" value="200" />
+
+<!-- api.nio.buffers.ShortBufferWrapGetTest -->
+
+ <!-- number of iterations to call/initialize one wrap/put/get in a cycle -->
+ <property name="api.nio.buffers.ShortBufferWrapGetTest.iterations" value="100" />
+
+ <!-- size of allocated buffer -->
+ <property name="api.nio.buffers.ShortBufferWrapGetTest.buffer_size" value="200" />
+
+<!-- api.io.IOTest -->
+
+ <!-- number of files to work with -->
+ <property name="api.io.IOTest.n_files" value="50" />
+
+<!-- api.net.NetClient -->
+
+ <!-- number of simultaneously executed clients -->
+ <property name="api.net.NetClient.n_clients" value="10" />
+
+ <!-- port to use -->
+ <property name="api.net.NetClient.port" value="8000" />
+
+ <!-- number of threads to run -->
+ <property name="api.net.NetClient.n_threads" value="5" />
+
+<!-- vm.classloading.ClassUnloadingTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.classloading.ClassUnloadingTest.n_threads" value="100" />
+
+ <!-- number of class each thread should load by custom classloader -->
+ <property name="vm.classloading.ClassUnloadingTest.n_classes" value="150" />
+
+<!-- vm.classloading.ClassAttributesTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.classloading.ClassAttributesTest.n_threads" value="8" />
+
+<!-- vm.classloading.DelegationModelTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.classloading.DelegationModelTest.n_threads" value="10" />
+
+<!-- vm.classloading.MultiThreadedLoading -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.classloading.MultiThreadedLoading.n_threads" value="30" />
+
+<!-- vm.classloading.ClassReflectionTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.classloading.ClassReflectionTest.n_threads" value="8" />
+
+<!-- vm.exceptions.ExceptionsTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.exceptions.ExceptionsTest.n_threads" value="100" />
+
+ <!-- the length of handler's chain (recursion depth) -->
+ <property name="vm.exceptions.ExceptionsTest.depth" value="150" />
+
+<!-- vm.finalization.FinalizeResourceOrientedTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.finalization.FinalizeResourceOrientedTest.n_threads" value="10" />
+
+<!-- vm.finalization.FinalizeThrowRestoreTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.finalization.FinalizeThrowRestoreTest.n_threads" value="10" />
+
+<!-- vm.gc.GCTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.gc.GCTest.n_threads" value="32" />
+
+<!-- vm.stack.StackFramesRestoreTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.stack.StackFramesRestoreTest.n_threads" value="10" />
+
+<!-- vm.stack.StackUnwindTest -->
+
+ <!-- number of running in parallel threads -->
+ <property name="vm.stack.StackUnwindTest.n_threads" value="100" />
+
+ <!-- number of iterations in every thread -->
+ <property name="vm.stack.StackUnwindTest.n_iters" value="1000" />
+
+</project>
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.normal.mode.settings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.vm.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.vm.xml?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.vm.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.vm.xml Fri Jun 8 09:34:52 2007
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<project name="run.vm.tests" default="run.vm" basedir=".">
+
+ <description> Runs all tests from vm/ </description>
+
+ <target name="run.vm" depends="run.vm.stack, run.vm.classloading, run.vm.finalization, run.vm.exceptions, run.vm.gc"/>
+
+ <target name="run.vm.classloading">
+
+ <run-pjava-test test="vm.classloading.DelegationModelTest"
+ args="${vm.classloading.DelegationModelTest.n_threads} ${test.classes.dir}"/>
+
+ <run-pjava-test test="vm.classloading.MultiThreadedLoading"
+ args="${vm.classloading.MultiThreadedLoading.n_threads} ${test.classes.dir}"/>
+
+ <run-pjava-test test="vm.classloading.ClassUnloadingTest"
+ args="${test.classes.dir} ${vm.classloading.ClassUnloadingTest.n_classes}
+ ${vm.classloading.ClassUnloadingTest.n_threads}"/>
+
+ <run-pjava-test test="vm.classloading.ClassAttributesTest"
+ args="${vm.classloading.ClassUnloadingTest.n_threads}"/>
+
+ <run-pjava-test test="vm.classloading.ClassReflectionTest"
+ args="${vm.classloading.ClassReflectionTest.n_threads}"/>
+
+ </target>
+
+ <target name="run.vm.finalization">
+
+ <run-pjava-test test="vm.finalization.FinalizeResourceOrientedTest"
+ args="${vm.finalization.FinalizeResourceOrientedTest.n_threads} ${test.classes.dir} ${work.dir}"/>
+
+ <run-pjava-test test="vm.finalization.FinalizeThrowRestoreTest"
+ args="${vm.finalization.FinalizeThrowRestoreTest.n_threads}"/>
+
+ <run-pjava-test test="vm.finalization.ArrayElemFinalizationTest"/>
+ </target>
+
+ <target name="run.vm.gc">
+
+ <run-pjava-test test="vm.gc.GCTest"
+ args="${vm.gc.GCTest.n_threads}"/>
+
+ </target>
+
+ <target name="run.vm.stack">
+
+ <run-pjava-test test="vm.stack.StackFramesRestoreTest"
+ args="${vm.stack.StackFramesRestoreTest.n_threads} ${test.classes.dir}"/>
+
+ <run-pjava-test test="vm.stack.StackUnwindTest"
+ args="${vm.stack.StackUnwindTest.n_threads} ${vm.stack.StackUnwindTest.n_iters}"/>
+
+ </target>
+
+ <target name="run.vm.exceptions">
+
+ <run-pjava-test test="vm.exceptions.ExceptionsTest"
+ args="${vm.exceptions.ExceptionsTest.n_threads}
+ ${vm.exceptions.ExceptionsTest.depth}"/>
+ </target>
+
+</project>
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.vm.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.xml?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.xml (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.xml Fri Jun 8 09:34:52 2007
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<project name="run.reliability.tests" default="run" basedir=".">
+
+ <description>Run reliability testsuite </description>
+
+ <!-- path to the tested runtime -->
+ <property name="jvm.under.test" location="C:\jdk1.5.0_06\jre\bin\java" />
+
+ <property name="jvm.args" value="-Xmx256m" />
+
+ <!-- This VM option may be needed as well: -Djava.security.policy= [...]/config/java.policy -->
+
+ <!-- specify directory where tests can create their working files -->
+ <property name="work.dir" location="../work" />
+ <mkdir dir="${work.dir}"/>
+
+ <!-- specify directory where tests can store their output -->
+ <property name="report.dir" location="../report" />
+ <mkdir dir="${report.dir}"/>
+
+ <!-- each test will be executed in a cycle ~test.duration seconds -->
+ <property name="test.duration" value="10" />
+
+ <!-- executed test's process will be killed after test.timeout milliseconds -->
+ <property name="test.timeout" value="100000" />
+
+ <!-- if set to "true", stops test execution after first failure. If set to
+ "false", then tests will continue to run -->
+ <property name="stop.after.fail" value="false"/>
+
+ <!-- Path to a file with test-specific settings -->
+ <property name="config.file" location="run.normal.mode.settings.xml"/>
+
+ <!-- Path to a exclude file -->
+ <property name="exclude.file" location="exclude"/>
+ <property file="${exclude.file}"/>
+
+ <!-- a path to the root of the suite - i.e. directory under which there is src/ subdirectory -->
+ <property name="test.root.dir" location=".." />
+
+ <property name="test.source.dir" location="${test.root.dir}/src/java" />
+
+ <!-- change this path to point to clasees/ directory if it differs from default -->
+ <property name="test.classes.dir" location="${test.root.dir}/deploy/classes" />
+
+ <property name="test.class.path" location="${test.classes.dir}" />
+
+
+ <property name="test.package.base" value="org.apache.harmony.test.reliability" />
+
+ <property name="test.runner.class" value="${test.package.base}.share.ReliabilityTestStarter" />
+
+ <property name="class.name.opt" value="-testClassName" />
+
+ <property name="test.duration.opt" value="-testTimeOut ${test.duration}" />
+
+ <property name="test.mode.opt" value="-testReliabilityMode longrunning" />
+
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <pathelement location="ant-contrib.jar" />
+ </classpath>
+ </taskdef>
+
+
+ <!-- Macrodefinition launching Plain Java test -->
+ <macrodef name="run-pjava-test">
+ <attribute name="test"/>
+ <attribute name="classname" default="${test.runner.class}"/>
+ <attribute name="classpath" default=""/>
+ <attribute name="expected-code" default="104"/>
+ <attribute name="vmarg" default="${jvm.args}"/>
+ <attribute name="args" default=""/>
+ <element name="java-element" optional="true"/>
+ <sequential>
+ <if>
+ <not>
+ <isset property="@{test}"/>
+ </not>
+ <then>
+ <echo message="Running test: @{test}"/>
+ <java jvm="${jvm.under.test}"
+ classname="@{classname}"
+ resultproperty="@{test}.res.code"
+ output="${report.dir}/@{test}.txt"
+ fork="yes"
+ timeout="${test.timeout}">
+ <java-element/>
+ <jvmarg line="@{vmarg}" />
+ <arg line="${test.mode.opt} ${test.duration.opt} ${class.name.opt}
+ ${test.package.base}.@{test} @{args}" />
+ <classpath>
+ <pathelement path="${test.class.path}"/>
+ <pathelement path="@{classpath}"/>
+ </classpath>
+ </java>
+
+ <condition property="failed"
+ value="true">
+ <not>
+ <equals arg1="${@{test}.res.code}" arg2="@{expected-code}"/>
+ </not>
+ </condition>
+
+ <condition property="failures.@{test}"
+ value="0"
+ else="1">
+ <equals arg1="${@{test}.res.code}" arg2="@{expected-code}"/>
+ </condition>
+
+ <replace file="${report.dir}/@{test}.txt" token="<" value="LT" />
+ <replace file="${report.dir}/@{test}.txt" token=">" value="GT" />
+ <replace file="${report.dir}/@{test}.txt" token="&" value=" AMP" />
+ <!--replace file="${report.dir}/@{test}.txt" token=":" value=";" /-->
+
+ <loadfile property="@{test}.tmp.out" srcFile="${report.dir}/@{test}.txt" />
+
+ <if>
+ <equals arg1="${@{test}.res.code}" arg2="@{expected-code}"/>
+ <then>
+<echo file="${report.dir}/TEST-${test.package.base}@{test}.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="0" failures="0" name="@{test}" tests="1" time="0.01">
+<testcase classname="@{test}" name="test" time="0.1"/>
+<system-out><![CDATA[@out]!]></system-out>
+</testsuite>]]>
+</echo>
+ <!--loadfile property="@{test}.tmp.out" srcFile="${report.dir}/@{test}.txt" /-->
+ <if>
+ <isset property="@{test}.tmp.out"/>
+ <then>
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@out]!" value="${@{test}.tmp.out}]" />
+ </then>
+ <else>
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@out]!" value="]" />
+ </else>
+ </if>
+ </then>
+ <else>
+<echo file="${report.dir}/TEST-${test.package.base}@{test}.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="0" failures="1" name="@{test}" tests="1" time="0.01">
+<testcase classname="@{test}" name="test" time="0.1"><error message="FAILED"> @@@d </error></testcase>
+</testsuite>]]>
+</echo>
+
+<!--system-out><![CDATA[]]></system-out-->
+
+ <!--loadfile property="@{test}.tmp.out" srcFile="${report.dir}/@{test}.txt" /-->
+ <if>
+ <isset property="@{test}.tmp.out"/>
+ <then>
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@@@d" value="${@{test}.tmp.out}" />
+ </then>
+ <else>
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@@@d" value="" />
+ </else>
+ </if>
+
+ </else>
+ </if>
+
+ <!--replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@fff" value="${failures.@{test}}" />
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@eee" value="${errormessage.@{test}}" /-->
+
+ <!--loadfile property="@{test}.tmp.out" srcFile="${report.dir}/@{test}.txt" />
+ <replace file="${report.dir}/TEST-${test.package.base}@{test}.xml" token="@out]!" value="${@{test}.tmp.out}]" /-->
+
+ <!--echo message="failed: ${failed}"/-->
+
+ <!--echo message="failures: ${failures.@{test}}"/-->
+
+ <fail>
+Test '@{test}' FAILED! (${@{test}.res.code} exit code, instead of expected @{expected-code})
+See ${report.dir}/@{test}.txt file for details.
+ <condition>
+ <and>
+ <istrue value="${stop.after.fail}"/>
+ <not>
+ <equals arg1="${@{test}.res.code}" arg2="@{expected-code}"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+ </then>
+ <else>
+ <!--echo message="Test @{test} is skipped (excluded)"/-->
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+
+ <import file="${config.file}"/>
+
+ <import file="run.api.nio.xml" />
+ <import file="run.api.zip.xml"/>
+ <import file="run.api.kernel.xml"/>
+ <import file="run.api.text.xml"/>
+ <import file="run.api.io.xml"/>
+ <import file="run.api.net.xml"/>
+ <import file="run.vm.xml"/>
+ <import file="run.api.util.xml"/>
+
+
+ <target name="run" depends="run.api.zip, run.api.kernel,
+ run.api.text, run.api.nio,
+ run.api.io, run.api.net, run.vm, run.api.util"/>
+
+ <fail message="There were test failures" if="failed"/>
+ <target name="clean">
+ <delete dir="${work.dir}" />
+ <delete dir="${report.dir}" />
+ </target>
+
+</project>
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/run/run.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/IOTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/IOTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/IOTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/IOTest.java Fri Jun 8 09:34:52 2007
@@ -0,0 +1,927 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+/**
+ * @author Nikolay V. Bannikov
+ * @version $Revision: 1.6 $
+ */
+
+package org.apache.harmony.test.reliability.api.io;
+
+
+import org.apache.harmony.test.reliability.share.Test;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.BufferedInputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.RandomAccessFile;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.BufferedOutputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.zip.ZipEntry;
+import java.util.zip.CRC32;
+import java.util.zip.CheckedOutputStream;
+import java.util.zip.ZipOutputStream;
+import java.util.zip.CheckedInputStream;
+import java.util.zip.ZipInputStream;
+
+import java.util.jar.JarOutputStream;
+import java.util.jar.JarInputStream;
+
+/**
+ * Goal: check for intermittent errors operating with a file via java.io classes.
+ *
+ * Idea: The test uses java.io.* API methods working with files for runtime testing -
+ * many files of various types (java, zip, jar, tmp) are created in the test and
+ * the input/output operations are performed on them.
+ * This test case is repeated until TestTimeout for reliability testing
+ *
+ */
+
+public class IOTest extends Test {
+
+ String separator = File.separator;
+ String filedir = System.getProperty("java.io.tmpdir") + separator + "reliability_io";
+
+ public int test(String[] params) {
+
+ int cnt = Integer.parseInt(params[0]);
+ if (cnt < 4 ) {
+ cnt = 100;
+ } else {
+ cnt = cnt/4;
+ }
+
+ String path_to_files = params[1];
+
+ if (!path_to_files.endsWith("auxiliary")) {
+ log.add("invalid path to the golden files");
+ return fail("Failed.");
+ }
+ // log.add("tmpdir = " + filedir);
+
+ File temp = new File(filedir);
+
+ if(temp.exists()) {
+ File[] lstf = temp.listFiles();
+ for( int i = 0; i < lstf.length; i++) {
+ if( !lstf[i].delete()) {
+ return fail("Delete " + lstf[i].getName() + " file: Failed.");
+
+ }
+ }
+
+ }
+
+ temp.mkdir();
+ temp.deleteOnExit();
+
+ String[] listFileNames = new String[cnt];
+
+ String javaFileName = "java_file.java";
+
+ if(System.getProperty("os.name").indexOf("Windows") == -1) {
+ javaFileName = "java_file_lnx.java";
+ }
+
+ if(!createEmptyFiles("file", ".java", filedir, cnt)) {
+ return fail("Creates a new empty file: Failed.");
+ }
+
+ if(!createTMP("file", "tmp", filedir, cnt)) {
+ return fail("Creates a new tmp file: Failed.");
+ }
+
+ if(!copyZipContent(path_to_files + separator + "zip_file.zip", filedir + separator + "file", cnt)) {
+ return fail("Copy a zip content: Failed.");
+ }
+
+ if(!copyJarContent(path_to_files + separator + "jar_file.jar", "file", cnt)) {
+ return fail("Copy a jar content: Failed.");
+ }
+
+ if(!copyJavaFileContent(path_to_files + separator + javaFileName, filedir + separator + "file", ".java", cnt)) {
+ return fail("Copy a java file content: Failed.");
+ }
+
+ listFileNames = listFileNamesInDirectory(filedir, "tmp");
+ if(!copyContentToTmpFiles(path_to_files + separator + javaFileName, listFileNames, filedir, cnt)) {
+ return fail("Copy a content to tmp file: Failed.");
+ }
+
+ String[] listOutFileNames = listFileNamesInDirectory(filedir, "file", ".java");
+ if(!copyFilesContentUseString(filedir, "file", ".out", listOutFileNames, cnt)) {
+ return fail("Copy a content to file.out: Failed.");
+ }
+
+ if(!copyFilesContentUseString(filedir, "tmp_file", ".out", listFileNames, cnt)) {
+ return fail("Copy a content to tmp_file.out: Failed.");
+ }
+
+ String[] listAllFiles = temp.list();
+ File[] listFiles = temp.listFiles();
+ int fileCount = 0;
+ for( int i = 0; i < listFiles.length; i++) {
+ if( listFiles[i].isFile()) {
+ listAllFiles[fileCount] = listFiles[i].getName();
+ fileCount++;
+ }
+ }
+
+ if(!compressZip(filedir, "allfileszip.zip", "jar", listAllFiles)) {
+ return fail("Compress a zip file: Failed.");
+ }
+
+ String fileName;
+ for( int i = 0; i < listFiles.length; i++) {
+ fileName = listAllFiles[i];
+ if(!fileName.endsWith("jar") && !fileName.startsWith("allfileszip")) {
+ listFiles[i].delete();
+ }
+ }
+
+ if(!unZipFile(filedir, "allfileszip.zip")) {
+ return fail("Uncompress allfileszip.zip file: Failed.");
+ }
+
+ if(!unZipListFiles(filedir, "file", "zip", listAllFiles, "file_from_zip")) {
+ return fail("Uncompress file.zip files: Failed.");
+ }
+
+ if(!compressZip(filedir, "allfileszip.jar", "jar", listAllFiles)) {
+ return fail("Uncompress allfileszip.jar file: Failed.");
+ }
+
+ if(!unZipListFiles(filedir, "file", "jar", listAllFiles, "file_from_jar")) {
+ return fail("Uncompress file.jar files: Failed.");
+ }
+
+ listFiles = temp.listFiles();
+ if(!renameFiles("tmp", "renamed_tmp_file", listFiles)) {
+ return fail("Rename tmp files: Failed.");
+ }
+
+ if(!renameFiles("file", "java", "renamed_out_file", listFiles)) {
+ return fail("Rename file.java: Failed.");
+ }
+
+ if(!renameFiles("file", "out", "renamed_out_file", listFiles)) {
+ return fail("Rename file.out files: Failed.");
+ }
+
+ if(!renameFiles("file_from_zip","", "renamed_file_from_zip", listFiles)) {
+ return fail("Rename file_from_zip.out files: Failed.");
+ }
+
+ if(!compareFilesContent(temp, path_to_files + separator + javaFileName, "renamed_out_file")) {
+ return fail("Check renamed_out_file files: Failed.");
+ }
+
+ if(!compareFilesContent(temp, path_to_files + separator + javaFileName, "renamed_tmp_file")) {
+ return fail("Check renamed_tmpt_file: Failed.");
+ }
+
+ if(!compareFilesContent(temp, filedir + separator + "renamed_file_from_zip0", "renamed_file_from_zip")) {
+ return fail("Check renamed_file_from_zip.");
+ }
+
+
+ listFiles = temp.listFiles();
+ for(int i = 0; i < listFiles.length; i++) {
+ if(!listFiles[i].delete()) {
+ log.add("delete " + listFiles[i].getName() + " failed");
+ return fail("Failed.");
+ }
+ }
+
+ File[] unexisted_file = new File[cnt];
+
+ for (int i = 0; i < cnt; i++) {
+ unexisted_file[i] = new File(filedir + separator + "file"+i+".java");
+ }
+
+ for (int i = 0; i < cnt; i++) {
+ unexisted_file[i].delete();
+ }
+
+ return pass("OK");
+ }
+
+
+ /* Create empty files */
+ protected boolean createEmptyFiles(String prefix, String suffix, String directory, int numfiles) {
+ File file;
+ for (int i = 0; i < numfiles; i++) {
+ try {
+ file = new File(directory + separator + prefix + i + suffix);
+ file.createNewFile();
+ } catch (IOException e) {
+
+ log.add("Create empty files: IOException during test execution");
+ log.add(e);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* Create tmp files */
+ protected boolean createTMP(String prefix, String suffix, String directory, int numfiles) {
+
+ File dir = new File(directory);
+
+ for (int i = 0; i < numfiles; i++) {
+ try {
+ File.createTempFile(prefix, suffix, dir).getName();
+ } catch (IOException e) {
+
+ log.add("Create TMP file "+ prefix + i +suffix +": IOException during test execution");
+ log.add(e);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* Copy the content of zip files */
+ protected boolean copyZipContent(String pathtoparentfiles, String chaildname, int numfiles) {
+
+ BufferedWriter bufWriter = null;
+ BufferedReader bufReader = null;
+ File parentFile, childFile;
+ int singlCharacter;
+ String fileName;
+
+ for (int i = 0; i < numfiles; i++) {
+ parentFile = new File(pathtoparentfiles);
+ fileName = chaildname + i + ".zip";
+ childFile = new File(fileName);
+
+ try {
+ childFile.createNewFile();
+ } catch (IOException e) {
+ log.add("creates a new, empty zip file : IOException during test execution");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ bufReader = new BufferedReader(new FileReader(parentFile));
+ bufWriter = new BufferedWriter(new FileWriter(fileName));
+ while((singlCharacter = bufReader.read()) != -1) {
+ bufWriter.write(singlCharacter);
+ }
+
+ bufReader.close();
+ bufWriter.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of zip: file" + parentFile +" does not exist");
+ log.add(e);
+ return false;
+ } catch (IOException ee) {
+ log.add("Copy the content of zip: file " + fileName + " cannot be opened");
+ log.add(ee);
+ return false;
+ } finally {
+ try {
+ bufReader.close();
+ bufWriter.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ }
+ }
+ return true;
+ }
+
+ /* Copy the content of jar files */
+ protected boolean copyJarContent(String pathtoparentfiles, String chaildname, int numfiles) {
+
+ RandomAccessFile wf = null;
+ RandomAccessFile rf = null;
+ File parentFile;
+ String fileName;
+ byte[] cbuf = new byte[4128];
+
+ for (int i = 0; i < numfiles; i++) {
+ parentFile = new File(pathtoparentfiles);
+ fileName = filedir + separator + chaildname + i + ".jar";
+ try {
+ rf =new RandomAccessFile(parentFile, "r");
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of jar: file " + parentFile +" does not exist");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ wf =new RandomAccessFile(fileName, "rw");
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of jar: file " + fileName +" does not exist");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ rf.read(cbuf);
+ } catch (IOException e) {
+ log.add("Read the content of " + parentFile + " jar: I/O error occurs");
+ log.add(e);
+ return false;
+ } finally {
+ try {
+ rf.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ }
+
+ try {
+ wf.write(cbuf);
+ } catch (IOException e) {
+ log.add("Write the content to " + fileName + " jar: I/O error occurs");
+ log.add(e);
+ return false;
+ } finally {
+ try {
+ wf.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ }
+
+
+ }
+ return true;
+ }
+
+ /* Copy the content of java files */
+ protected boolean copyJavaFileContent(String pathtoparentfiles, String pathtochaild, String suffix, int numfiles) {
+
+ BufferedInputStream in = null;
+ PrintStream out = null;
+ BufferedReader bufReader = null;
+ File parentFile, childFile;
+ String str;
+
+ for (int i = 0; i < numfiles; i++) {
+
+ try {
+ in =new BufferedInputStream(new FileInputStream(pathtoparentfiles));
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of golden to file.java: file " + pathtoparentfiles + " does not exist");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ out = new PrintStream(new BufferedOutputStream(new FileOutputStream(pathtochaild + i + suffix)));
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of golden to file.java: file " + pathtochaild + i + suffix + " does not exist");
+ log.add(e);
+ return false;
+ }
+
+ bufReader = new BufferedReader(new InputStreamReader(in));
+
+ try {
+ while((str = bufReader.readLine()) != null) {
+ out.println(str);
+ }
+ } catch (IOException e) {
+ log.add("Copy the content of golden to file.java: IOException during test execution");
+ log.add(e);
+ return false;
+ } finally {
+ try {
+ in.close();
+ out.close();
+ bufReader.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ }
+
+ }
+ return true;
+ }
+
+ /* Returns an array of file names in the directory denoted by filename */
+ protected String[] listFileNamesInDirectory(String filedir, String filesname) {
+
+ File[] listFiles = new File(filedir).listFiles();
+ int filescnt = listFiles.length;
+ String[] listFileNames = new String[filescnt];
+ String str;
+ int index = 0;
+
+ for( int i = 0; i < filescnt; i++) {
+ str = listFiles[i].getName();
+ if(str.indexOf(filesname) != -1 && index < filescnt ) {
+ listFileNames[index] = str;
+ index++;
+ }
+ }
+ return listFileNames;
+ }
+
+ /* Returns an array of file names in the directory denoted by filename and extention */
+ protected String[] listFileNamesInDirectory(String filedir, String filesname, String extension) {
+
+ File[] listFiles = new File(filedir).listFiles();
+ int filescnt = listFiles.length;
+ String[] listFileNames = new String[filescnt];
+ String str;
+ int index = 0;
+
+ for( int i = 0; i < filescnt; i++) {
+ str = listFiles[i].getName();
+ if(str.indexOf(filesname) != -1 && str.endsWith(extension) && index < filescnt ) {
+ listFileNames[index] = str;
+ index++;
+ }
+ }
+ return listFileNames;
+ }
+
+ /* Copy the content of java file to tmp files*/
+ protected boolean copyContentToTmpFiles(String pathtoparentfiles, String[] chaildnames, String pathtolistfiles, int numfiles) {
+
+ BufferedInputStream in = null;
+ PrintWriter prnWriter = null;
+ BufferedReader bufReader = null;
+ String str;
+
+ if(numfiles <= chaildnames.length ) {
+ for (int i = 0; i < numfiles; i++) {
+ try {
+ in =new BufferedInputStream(new FileInputStream(pathtoparentfiles));
+ } catch (FileNotFoundException e) {
+ log.add("Copy the content of golden to tmp files: the file" + pathtoparentfiles + " does not exist");
+ log.add(e);
+ return false;
+ }
+
+ bufReader = new BufferedReader(new InputStreamReader(in));
+
+ try {
+ prnWriter = new PrintWriter(new BufferedWriter(new FileWriter(pathtolistfiles + separator + chaildnames[i])));
+ } catch (IOException e) {
+ log.add("Copy the content of golden to tmp files: the file" + chaildnames[i] + " does not exist");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ while((str = bufReader.readLine()) != null) {
+ prnWriter.println(str);
+ }
+ } catch (IOException e) {
+ log.add("Copy the content of golden to tmp files: IOException during test execution");
+ log.add(e);
+ return false;
+ } finally {
+ try {
+ prnWriter.close();
+ bufReader.close();
+ in.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ }
+
+ }
+ } else {
+ log.add("Incorrected number of files");
+ return false;
+ }
+ return true;
+ }
+
+ /* Copy the content of files */
+ protected boolean copyFilesContentUseString(String directory, String filename, String sufix, String[] chaildnames, int numfiles) {
+
+ PrintWriter prnWriter = null;
+ BufferedReader bufReader = null;
+ String str1 = new String();
+ String str2 = new String();
+
+ if(numfiles <= chaildnames.length ) {
+ for (int i = 0; i < numfiles; i++) {
+ str1 = new String();
+ str2 = new String();
+
+ try {
+ bufReader = new BufferedReader(new FileReader(directory + separator + chaildnames[i]));
+ while((str1 = bufReader.readLine()) != null) {
+ str2 += str1 + "\n";
+ }
+ } catch (FileNotFoundException e) {
+ log.add("Read the content of the file" + chaildnames[i] + ". The file does not exist");
+ log.add(e);
+ return false;
+ } catch (IOException ee) {
+ log.add("Read a line of text: I/O error occurs");
+ log.add(ee);
+ return false;
+ } finally {
+ try {
+ bufReader.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+
+ }
+
+ bufReader = new BufferedReader(new StringReader(str2));
+
+ try {
+ prnWriter = new PrintWriter(new BufferedWriter(new FileWriter(directory + separator + filename + i + sufix)));
+ } catch (IOException e) {
+ log.add("Write the content to the " + filename + i + sufix + " file");
+ log.add(e);
+ return false;
+ }
+
+ try {
+ while((str1 = bufReader.readLine()) != null) {
+ prnWriter.println(str1);
+ }
+ } catch (Exception e) {
+ log.add("write the file content to " + filename + i + sufix + ": Exception during test execution");
+ log.add(e);
+ return false;
+ } finally {
+
+ try {
+ bufReader.close();
+ } catch (IOException e) {
+ log.add(e);
+ }
+ prnWriter.close();
+ }
+ }
+ } else {
+ log.add("Incorrected number of files");
+ return false;
+ }
+ return true;
+ }
+
+ /* compress files to zip */
+ protected boolean compressZip(String directory, String filenamezip, String withoutfilesextension, String[] listfiles) {
+
+ BufferedReader bufReader;
+ FileOutputStream fos = null;
+ CheckedOutputStream checkoutput = null;
+ ZipOutputStream zos = null;
+ String fileName = "";
+
+ try {
+ fos = new FileOutputStream(directory + separator + filenamezip);
+ } catch (FileNotFoundException e) {
+ log.add("Read the content of the file" + filenamezip + ". The file does not exist");
+ log.add(e);
+ return false;
+ }
+
+ checkoutput = new CheckedOutputStream(fos, new CRC32());
+ zos = new ZipOutputStream(new BufferedOutputStream(checkoutput));
+
+ try {
+ for(int i = 0; i < listfiles.length; i++) {
+ fileName = listfiles[i];
+ if(!fileName.endsWith(withoutfilesextension)) {
+ bufReader = new BufferedReader(new FileReader(filedir + separator + listfiles[i]));
+ zos.putNextEntry(new ZipEntry(listfiles[i]));
+ int j;
+ while((j = bufReader.read()) != -1) {
+ zos.write(j);
+ }
+ bufReader.close();
+ }
+ }
+ zos.close();
+ fos.close();
+ checkoutput.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("Read the "+ fileName + " file: Exception during test execution");
+ log.add(e);
+ return false;
+
+ } catch (IOException ee) {
+ log.add("Compress the "+ filenamezip + ": Exception during test execution");
+ log.add(ee);
+ return false;
+ } finally {
+ try {
+ fos.close();
+ zos.close();
+ checkoutput.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+
+ return true;
+ }
+
+ /* uncompress files from zip file*/
+ protected boolean unZipFile(String directory, String filename) {
+
+ CheckedInputStream checkinput = null;
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+ ZipInputStream zis = null;
+ ZipEntry zipentry;
+ String zipentryfile = "";
+
+ try {
+ fis = new FileInputStream(directory + separator + filename);
+ } catch (FileNotFoundException e) {
+ log.add("Read the content of the file" + filename + ". The file does not exist");
+ log.add(e);
+ return false;
+ }
+ checkinput = new CheckedInputStream(fis, new CRC32());
+ zis = new ZipInputStream(new BufferedInputStream(checkinput));
+
+
+ try {
+ while((zipentry = zis.getNextEntry()) != null) {
+ int j;
+ zipentryfile = zipentry.toString();
+ fos = new FileOutputStream(directory + separator + zipentryfile);
+ while((j = zis.read()) != -1) {
+ fos.write(j);
+ }
+ fos.close();
+ }
+ zis.close();
+ fis.close();
+ checkinput.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("The file " + zipentryfile + "does not exist " + " file: Exception during test execution");
+ log.add(e);
+ return false;
+ } catch (IOException ee) {
+ log.add("Unzip the " + filename + ": Exception during test execution");
+ log.add(ee);
+ return false;
+ } finally {
+
+ try {
+ zis.close();
+ fis.close();
+ checkinput.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+
+ return true;
+ }
+
+ /* uncompress files from list of zip, jar files */
+ protected boolean unZipListFiles(String directory, String filename, String filext, String[] listfiles, String outfilename) {
+
+ CheckedInputStream checkinput = null;
+ FileInputStream fis = null;
+ FileOutputStream fos;
+ ZipInputStream zis = null;
+ JarInputStream jis = null;
+ ZipEntry zipentry;
+ String zipFileName = "";
+ String zipentryfile;
+ int zip_entry_file = 0;
+ int j;
+
+
+ for(int i = 0; i < listfiles.length; i++) {
+ zipFileName = listfiles[i];
+ if(zipFileName.startsWith(filename) && zipFileName.endsWith(filext)) {
+ try {
+ fis = new FileInputStream(directory + separator + zipFileName);
+ } catch (FileNotFoundException e) {
+ log.add("The file " + zipFileName + "does not exist " + " : Exception during test execution");
+ log.add(e);
+ return false;
+ }
+
+ checkinput = new CheckedInputStream(fis, new CRC32());
+
+ if(filext.endsWith("zip")) {
+ zis = new ZipInputStream(new BufferedInputStream(checkinput));
+
+ try {
+ while((zipentry = zis.getNextEntry()) != null) {
+ j = 0;
+ zipentryfile = zipentry.toString();
+ fos = new FileOutputStream(directory + separator + outfilename + zip_entry_file);
+ while((j = zis.read()) != -1) {
+ fos.write(j);
+ }
+ zip_entry_file++;
+ fos.close();
+ }
+ zis.close();
+ fis.close();
+ checkinput.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("The file " + zip_entry_file + "does not exist " + " : Exception during test execution");
+ log.add(e);
+ return false;
+ } catch (IOException ee) {
+ log.add("Reads the next ZIP file entry : Exception during test execution");
+ log.add(ee);
+ return false;
+ } finally {
+
+ try {
+ zis.close();
+ fis.close();
+ checkinput.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+ } else if (filext.endsWith("jar")) {
+ try {
+ jis = new JarInputStream(new BufferedInputStream(checkinput));
+ } catch (IOException e) {
+ log.add("Creates a new JarInputStream: I/O error has occurred");
+ log.add(e);
+ return false;
+ }
+
+ try {
+
+ while((zipentry = jis.getNextEntry()) != null) {
+ j = 0;
+ zipentryfile = zipentry.toString();
+ fos = new FileOutputStream(new File(directory + separator + zipentryfile));
+ while((j = jis.read()) != -1) {
+ fos.write(j);
+ }
+ fos.close();
+ }
+ fis.close();
+ jis.close();
+ checkinput.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("The file " + zip_entry_file + "does not exist " + " : Exception during test execution");
+ log.add(e);
+ return false;
+ } catch (IOException ee) {
+ log.add("Reads the next ZIP file entry : Exception during test execution");
+ log.add(ee);
+ return false;
+ } finally {
+ try {
+ fis.close();
+ jis.close();
+ checkinput.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+ } else {
+ log.add("Incorrect extension of file");
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /* rename files if this name starts and ends with the specified prefix */
+ protected boolean renameFiles(String startsWithorendsWith, String newfilename, File[] listFiles) {
+ String file_name;
+ int idx = 0;
+ for(int i = 0; i < listFiles.length; i++) {
+ file_name = listFiles[i].getName();
+ if(file_name.startsWith(startsWithorendsWith) || file_name.endsWith(startsWithorendsWith)) {
+ listFiles[i].renameTo(new File(filedir + separator + newfilename + idx));
+ idx++;
+ }
+ }
+ return true;
+ }
+
+ /* rename files if this name starts with the specified prefix and ends with the other specified prefix */
+ protected boolean renameFiles(String startsWith, String endsWith, String newfilename, File[] listFiles) {
+ String file_name;
+ int idx = 0;
+ for(int i = 0; i < listFiles.length; i++) {
+ file_name = listFiles[i].getName();
+ if (file_name.startsWith(startsWith) && file_name.endsWith(endsWith)) {
+ listFiles[i].renameTo(new File(filedir + separator + newfilename + idx));
+ idx++;
+ }
+ }
+ return true;
+ }
+
+ /* compare file contents */
+ protected boolean compareFilesContent(File directory, String pathtogolden, String filename) {
+
+ String file_name;
+ RandomAccessFile rf = null;
+ File[] listFiles = directory.listFiles();
+ byte[] golden_file;
+ byte[] checks_file;
+ int file_length;
+ try {
+ rf = new RandomAccessFile(pathtogolden, "r");
+ file_length = (int)rf.length();
+ golden_file = new byte[file_length];
+ checks_file = new byte[file_length];
+ rf.readFully(golden_file);
+ rf.close();
+
+ } catch (FileNotFoundException e) {
+ log.add("The " + pathtogolden + " file does not exist: Exception during test execution");
+ log.add(e);
+ return false;
+
+ } catch (IOException ee) {
+ log.add("Reads from file " + pathtogolden + " into the byte array: Exception during test execution ");
+ log.add(ee);
+ return false;
+ } finally {
+
+ try {
+ rf.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+
+ for(int i = 0; i < listFiles.length; i++) {
+ file_name = listFiles[i].getName();
+ if(file_name.startsWith(filename)) {
+ try {
+
+ rf =new RandomAccessFile(listFiles[i], "r");
+ rf.readFully(checks_file);
+ rf.close();
+ } catch (FileNotFoundException e) {
+ log.add("The " + listFiles[i] + " file does not exist: Exception during test execution");
+ log.add(e);
+ return false;
+
+ } catch (IOException ee) {
+ log.add("Reads from file" + listFiles[i] + "into the byte array: Exception during test execution");
+ log.add(ee);
+ return false;
+ } finally {
+
+ try {
+ rf.close();
+ } catch (Exception e) {
+ log.add(e);
+ }
+ }
+
+ if(!java.util.Arrays.equals(golden_file, checks_file)) {
+ log.add("Checks the" + file_name + ": failed");
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.exit(new IOTest().test(args));
+ }
+}
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/IOTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/jar_file.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/jar_file.jar?view=auto&rev=545554
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/jar_file.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file.java Fri Jun 8 09:34:52 2007
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+public class java_file {
+ public static void main(String args[]) throws Exception {
+ System.out.println("PASSED");
+ }
+}
+
+
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file_lnx.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file_lnx.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file_lnx.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file_lnx.java Fri Jun 8 09:34:52 2007
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+public class java_file_lnx {
+ public static void main(String args[]) throws Exception {
+ System.out.println("PASSED");
+ }
+}
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/java_file_lnx.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/zip_file.zip
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/zip_file.zip?view=auto&rev=545554
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/io/auxiliary/zip_file.zip
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/kernel/args/AppVMCLParamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/kernel/args/AppVMCLParamTest.java?view=auto&rev=545554
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/kernel/args/AppVMCLParamTest.java (added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/kernel/args/AppVMCLParamTest.java Fri Jun 8 09:34:52 2007
@@ -0,0 +1,286 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+/**
+ * @author Oleg Oleinik
+ * @version $Revision: 1.4 $
+ */
+
+package org.apache.harmony.test.reliability.api.kernel.args;
+
+import org.apache.harmony.test.reliability.share.Test;
+
+import java.util.Random;
+
+
+/**
+ * Goal: check that Runtime.exec() / VM process big number of big application arguments
+ *
+ * The test does:
+ *
+ * 1. Reads parameters, which are:
+ * 1) args[0] - number of iterations and maximum number of arguments and muliplied by
+ * 'Multiplier' (typically 10) is a maximum size of an argument (number of chars).
+ * 2) args[1] - path to VM executable file
+ * 3) args[2] - VM options separated by 'VM_OPTS_SEPARATOR' (typically, ":").
+ *
+ * 2. Creates an array of VM options to iterate through.
+ *
+ * 3. Creates arrays of arrays of application parameters.
+ * Size of the array is args[0]
+ * Each array's size is form 1 to args[0]
+ * Maximum size of application parameter/array element is from 10 to args[0] * 10.
+ *
+ * 4. Iterates through VM opetions and for each VM option iterates through array of application
+ * parameters.
+ *
+ * 5. On each iteration invokes Runtime.exec() with command line to start VM with option, run App
+ * class and pass application parameters. Typically, the command to execute looks like:
+ * <vm> <vm option> App <param> .. <param>
+ *
+ */
+
+
+public class AppVMCLParamTest extends Test {
+
+ static Random r = new Random(10);
+
+ public static final int EXIT_VALUE = 0xFFFFF;
+
+ String vmPath = "";
+
+ String vmOpts = "";
+
+ String classPath = "";
+
+ String appName = "org.apache.harmony.test.reliability.api.kernel.args.AppParam";
+
+ int N_OF_ITERATIONS = 10;
+
+ int Multiplier = 10;
+
+ String VM_OPTS_SEPARATOR = ":";
+
+
+ public static void main(String[] args) {
+ System.exit(new AppVMCLParamTest().test(args));
+ }
+
+
+ public int test(String[] params) {
+
+ boolean failed = false;
+
+ parseParams(params);
+
+ String[][] vmOptions = createVMOptsSets(vmOpts, classPath);
+
+ String[][] appParams = createAppParamsSets();
+
+ for (int i = 0; i < vmOptions.length; ++i) {
+
+ for (int j = 0; j < appParams.length; ++j) {
+
+ String[] cmdLine = createCmdLine(vmPath, vmOptions[i], appName, appParams[j]);
+
+ //for (int x = 0; x < cmdLine.length; ++x) {
+ // log.add(" " + cmdLine[x]);
+ //}
+ //log.add("");
+
+ try {
+
+ Process p = Runtime.getRuntime().exec(cmdLine);
+
+ p.waitFor();
+
+ if (p.exitValue() != 0 && p.exitValue() != appParams[j].length + 1) {
+ log.add("Started process returned unexpected exit code (problem?) " + p.exitValue() +
+ " instead of " + (appParams[j].length + 1));
+ failed = true;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.add("Iteration: vm args index is " + i + ", application args index is " + j);
+ log.add("\n" + "VM argument: " + vmOptions[i][0] + "\n" +
+ "application arguments number is " + appParams[j].length +
+ "\n" + "maximum length of the last argument string is " +
+ (getStringSize(appParams[j].length + 1) + 1) + " chars");
+ return fail("Failed");
+ }
+ }
+ }
+
+ if (failed) {
+ return fail("Failed");
+ }
+
+ return pass("OK");
+ }
+
+
+ public void parseParams(String[] params) {
+
+ if (params.length >= 1) {
+ N_OF_ITERATIONS = Integer.parseInt(params[0]);
+ }
+
+ if (params.length >= 2) {
+ vmPath = params[1];
+ }
+
+ if (params.length >= 3) {
+ vmOpts = params[2];
+ }
+
+ if (params.length >= 4) {
+ classPath = params[3];
+ }
+
+ }
+
+
+ String[] createCmdLine(String vmPath, String[] vmOptions, String appName, String[] appParams) {
+
+ String[] cmdLine = new String[1 + vmOptions.length + 1 + 1 + appParams.length];
+
+ // cmdLine should be: <vm> <vm option> App <number_of_params> <param> .. <param>
+
+ cmdLine[0] = vmPath;
+ System.arraycopy(vmOptions, 0, cmdLine, 1, vmOptions.length);
+
+ cmdLine[vmOptions.length + 1] = appName;
+ cmdLine[vmOptions.length + 1 + 1] = "" + (appParams.length + 1);
+
+ System.arraycopy(appParams, 0, cmdLine, 1 + vmOptions.length + 1 + 1, appParams.length);
+
+ return removeEmptyStrings(cmdLine);
+
+ }
+
+ String[] removeEmptyStrings(String[] s){
+ int j = 0;
+ String[] ss = new String[s.length];
+
+ for (int i = 0; i < s.length; ++i){
+ if ("".equals(s[i])) {
+ continue;
+ }
+ ss[j++] = s[i];
+ }
+
+ String[] str = new String[j];
+
+ System.arraycopy(ss, 0, str, 0, str.length);
+
+ return str;
+ }
+
+ String[][] createAppParamsSets() {
+
+ String[][] appParams = new String[N_OF_ITERATIONS][];
+
+ for (int i = 0; i < appParams.length; ++i) {
+
+ appParams[i] = createRndStrArray(i + 1);
+
+ }
+
+ return appParams;
+ }
+
+
+ String[] createRndStrArray(int length) {
+
+ String[] s = new String[length];
+
+ for (int i = 0; i < s.length; ++i) {
+ s[i] = "\"" + createRndStr(getStringSize(i) + 1) + "\"";
+ }
+ return s;
+ }
+
+
+ String createRndStr(int length) {
+
+ char[] ch = new char[length];
+
+ for (int i = 0; i < length; ++i) {
+
+ while (true) {
+ char c = (char) r.nextInt(0xffff);
+ if (Character.isJavaIdentifierPart(c)) {
+ ch[i] = c;
+ break;
+ }
+ }
+
+ }
+
+ return new String(ch);
+ }
+
+
+ String[][] createVMOptsSets(String vmOpts, String classPath) {
+
+ // we do not create cobination of several vm options, just, one option at each run
+ // first, extract options from input parameter:
+
+ String[] vmopts = vmOpts.split(VM_OPTS_SEPARATOR);
+
+ String[][] s = new String[vmopts.length][];
+
+ for (int i = 0; i < s.length; ++i){
+ s[i] = new String[3];
+ s[i][0] = "-classpath";
+ s[i][1] = classPath;
+ s[i][2] = vmopts[i];
+ }
+
+ return s;
+ }
+
+
+ int getStringSize(int size) {
+ return size * Multiplier;
+ }
+}
+
+
+
+class AppParam {
+
+ public static void main(String[] args) {
+
+ int retValue = -10;
+
+ if (args.length == 0) {
+
+ retValue = -1;
+
+ } else {
+
+ retValue = args.length;
+
+ }
+
+ System.exit(retValue);
+ }
+
+}
+
Propchange: harmony/enhanced/buildtest/branches/2.0/tests/reliability/src/java/org/apache/harmony/test/reliability/api/kernel/args/AppVMCLParamTest.java
------------------------------------------------------------------------------
svn:eol-style = native