repo
stringlengths
1
191
file
stringlengths
23
351
code
stringlengths
0
5.32M
file_length
int64
0
5.32M
avg_line_length
float64
0
2.9k
max_line_length
int64
0
288k
extension_type
stringclasses
1 value
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedTBGTrialDagOrderTest.java
/* * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.dagorder; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class MixedTBGTrialDagOrderTest { public static final AtomicInteger TICKER = new AtomicInteger(); private static volatile int s1setup, s1teardown; private static volatile int s2setup, s2teardown; private static volatile int s3setup, s3teardown; private static volatile int run; @State(Scope.Group) public static class S3 { @Setup(Level.Trial) public void setupInstance() { s3setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s3teardown = TICKER.incrementAndGet(); } } @State(Scope.Benchmark) public static class S2 { @Setup(Level.Trial) public void setupInstance(S3 s3) { s2setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s2teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S1 { @Setup(Level.Trial) public void setupInstance(S2 s2) { s1setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s1teardown = TICKER.incrementAndGet(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(0) @Threads(1) public void test(S1 state) { run = TICKER.incrementAndGet(); Fixtures.work(); } @Test public void invokeAPI() throws RunnerException { for (int c = 0; c < Fixtures.repetitionCount(); c++) { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .syncIterations(false) .build(); new Runner(opt).run(); Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup); Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup); Assert.assertTrue(s1setup + " < " + run, s1setup < run); Assert.assertTrue(run + " < " + s1teardown, run < s1teardown); Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown); Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown); } } }
4,105
32.655738
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedTGBIterationDagOrderTest.java
/* * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.dagorder; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class MixedTGBIterationDagOrderTest { public static final AtomicInteger TICKER = new AtomicInteger(); private static volatile int s1setup, s1teardown; private static volatile int s2setup, s2teardown; private static volatile int s3setup, s3teardown; private static volatile int run; @State(Scope.Benchmark) public static class S3 { @Setup(Level.Iteration) public void setupInstance() { s3setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s3teardown = TICKER.incrementAndGet(); } } @State(Scope.Group) public static class S2 { @Setup(Level.Iteration) public void setupInstance(S3 s3) { s2setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s2teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S1 { @Setup(Level.Iteration) public void setupInstance(S2 s2) { s1setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s1teardown = TICKER.incrementAndGet(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(0) @Threads(1) public void test(S1 state) { run = TICKER.incrementAndGet(); Fixtures.work(); } @Test public void invokeAPI() throws RunnerException { for (int c = 0; c < Fixtures.repetitionCount(); c++) { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .syncIterations(false) .build(); new Runner(opt).run(); Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup); Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup); Assert.assertTrue(s1setup + " < " + run, s1setup < run); Assert.assertTrue(run + " < " + s1teardown, run < s1teardown); Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown); Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown); } } }
4,133
32.885246
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/MixedTGBTrialDagOrderTest.java
/* * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.dagorder; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class MixedTGBTrialDagOrderTest { public static final AtomicInteger TICKER = new AtomicInteger(); private static volatile int s1setup, s1teardown; private static volatile int s2setup, s2teardown; private static volatile int s3setup, s3teardown; private static volatile int run; @State(Scope.Benchmark) public static class S3 { @Setup(Level.Trial) public void setupInstance() { s3setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s3teardown = TICKER.incrementAndGet(); } } @State(Scope.Group) public static class S2 { @Setup(Level.Trial) public void setupInstance(S3 s3) { s2setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s2teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S1 { @Setup(Level.Trial) public void setupInstance(S2 s2) { s1setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s1teardown = TICKER.incrementAndGet(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(0) @Threads(1) public void test(S1 state) { run = TICKER.incrementAndGet(); Fixtures.work(); } @Test public void invokeAPI() throws RunnerException { for (int c = 0; c < Fixtures.repetitionCount(); c++) { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .syncIterations(false) .build(); new Runner(opt).run(); Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup); Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup); Assert.assertTrue(s1setup + " < " + run, s1setup < run); Assert.assertTrue(run + " < " + s1teardown, run < s1teardown); Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown); Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown); } } }
4,105
32.655738
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/ThreadIterationDagOrderTest.java
/* * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.dagorder; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class ThreadIterationDagOrderTest { public static final AtomicInteger TICKER = new AtomicInteger(); private static volatile int s1setup, s1teardown; private static volatile int s2setup, s2teardown; private static volatile int s3setup, s3teardown; private static volatile int run; @State(Scope.Thread) public static class S3 { @Setup(Level.Iteration) public void setupInstance() { s3setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s3teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S2 { @Setup(Level.Iteration) public void setupInstance(S3 s3) { s2setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s2teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S1 { @Setup(Level.Iteration) public void setupInstance(S2 s2) { s1setup = TICKER.incrementAndGet(); } @TearDown(Level.Iteration) public void tearDownInstance() { s1teardown = TICKER.incrementAndGet(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(0) @Threads(1) public void test(S1 state) { run = TICKER.incrementAndGet(); Fixtures.work(); } @Test public void invokeAPI() throws RunnerException { for (int c = 0; c < Fixtures.repetitionCount(); c++) { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .syncIterations(false) .build(); new Runner(opt).run(); Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup); Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup); Assert.assertTrue(s1setup + " < " + run, s1setup < run); Assert.assertTrue(run + " < " + s1teardown, run < s1teardown); Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown); Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown); } } }
4,617
33.721805
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/dagorder/ThreadTrialDagOrderTest.java
/* * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.dagorder; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class ThreadTrialDagOrderTest { public static final AtomicInteger TICKER = new AtomicInteger(); private static volatile int s1setup, s1teardown; private static volatile int s2setup, s2teardown; private static volatile int s3setup, s3teardown; private static volatile int run; @State(Scope.Thread) public static class S3 { @Setup(Level.Trial) public void setupInstance() { s3setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s3teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S2 { @Setup(Level.Trial) public void setupInstance(S3 s3) { s2setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s2teardown = TICKER.incrementAndGet(); } } @State(Scope.Thread) public static class S1 { @Setup(Level.Trial) public void setupInstance(S2 s2) { s1setup = TICKER.incrementAndGet(); } @TearDown(Level.Trial) public void tearDownInstance() { s1teardown = TICKER.incrementAndGet(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(0) @Threads(1) public void test(S1 state) { run = TICKER.incrementAndGet(); Fixtures.work(); } @Test public void invokeAPI() throws RunnerException { for (int c = 0; c < Fixtures.repetitionCount(); c++) { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .syncIterations(false) .build(); new Runner(opt).run(); Assert.assertTrue(s3setup + " < " + s2setup, s3setup < s2setup); Assert.assertTrue(s2setup + " < " + s1setup, s2setup < s1setup); Assert.assertTrue(s1setup + " < " + run, s1setup < run); Assert.assertTrue(run + " < " + s1teardown, run < s1teardown); Assert.assertTrue(s1teardown + " < " + s2teardown, s1teardown < s2teardown); Assert.assertTrue(s2teardown + " < " + s3teardown, s2teardown < s3teardown); } } }
4,589
33.511278
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/EmbeddedErrorsTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.results.RunResult; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class EmbeddedErrorsTest { @Benchmark public void test00_normal() throws InterruptedException { Thread.sleep(1); } @Benchmark public void test01_exceptional() { throw new IllegalStateException(); } @Benchmark public void test02_normal() throws InterruptedException { Thread.sleep(1); } // Embedded runs can not possibly survive either System.exit, or VM crash @Test public void test_FOE_false() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .forks(0) .shouldFailOnError(false) .build(); Collection<RunResult> results = new Runner(opt).run(); Assert.assertEquals(2, results.size()); } @Test public void test_FOE_true() throws RunnerException { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .forks(0) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have thrown the exception"); } catch (RunnerException e) { // expected } } }
3,214
33.569892
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/EmbeddedThrowExceptionTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class EmbeddedThrowExceptionTest { @Benchmark public void bench() throws MyException { throw new MyException("Something wicked"); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), false, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "MyException")); Assert.assertTrue(Shared.contains(lines, "Something wicked")); } public static class MyException extends Exception { public MyException(String s) { super(s); } } }
2,556
35.528571
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/EmbeddedThrowRuntimeExceptionTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class EmbeddedThrowRuntimeExceptionTest { @Benchmark public void bench() { throw new MyException("Something wicked"); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), false, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "MyException")); Assert.assertTrue(Shared.contains(lines, "Something wicked")); } public static class MyException extends RuntimeException { public MyException(String s) { super(s); } } }
2,551
35.457143
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedErrorsTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.results.RunResult; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import sun.misc.Unsafe; import java.lang.reflect.Field; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedErrorsTest { @Benchmark public void test00_normal() throws InterruptedException { Thread.sleep(1); } @Benchmark public void test01_exceptional() { throw new IllegalStateException(); } @Benchmark public void test02_normal() throws InterruptedException { Thread.sleep(1); } @Benchmark public void test03_exit() throws InterruptedException { System.exit(1); } @Benchmark public void test04_normal() throws InterruptedException { Thread.sleep(1); } private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException { Field f = Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (Unsafe) f.get(null); } @Benchmark public void test05_crash() throws InterruptedException, NoSuchFieldException, IllegalAccessException { // SIGSEGV in JVM getUnsafe().getInt(0); } @Benchmark public void test06_normal() throws InterruptedException { Thread.sleep(1); } @Benchmark public void test07_runtimeExit() throws InterruptedException { Runtime.getRuntime().exit(1); } @Benchmark public void test08_normal() throws InterruptedException { Thread.sleep(1); } @Benchmark public void test09_runtimeHalt() throws InterruptedException { Runtime.getRuntime().halt(1); } @Benchmark public void test10_normal() throws InterruptedException { Thread.sleep(1); } @Test public void test_FOE_false() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .forks(1) .shouldFailOnError(false) .build(); Collection<RunResult> results = new Runner(opt).run(); Assert.assertEquals(6, results.size()); } @Test public void test_FOE_true() throws RunnerException { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .forks(1) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have thrown the exception"); } catch (RunnerException e) { // expected } } }
4,399
30.654676
106
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedExit0Test.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedExit0Test { @Benchmark public void bench() throws InterruptedException { System.exit(0); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "VM prematurely exited before JMH had finished with it")); } }
2,363
36.52381
107
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedExit1Test.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedExit1Test { @Benchmark public void bench() throws InterruptedException { System.exit(1); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "forked VM failed with exit code 1")); Assert.assertTrue(Shared.contains(lines, "VM prematurely exited before JMH had finished with it")); } }
2,451
37.3125
107
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedExit42Test.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedExit42Test { @Benchmark public void bench() throws InterruptedException { System.exit(42); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "forked VM failed with exit code 42")); Assert.assertTrue(Shared.contains(lines, "VM prematurely exited before JMH had finished with it")); } }
2,454
37.359375
107
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedHalt1Test.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedHalt1Test { @Benchmark public void bench() throws InterruptedException { Runtime.getRuntime().halt(1); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "forked VM failed with exit code 1")); } }
2,357
36.428571
87
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedHalt42Test.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedHalt42Test { @Benchmark public void bench() throws InterruptedException { Runtime.getRuntime().halt(42); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "forked VM failed with exit code 42")); } }
2,360
36.47619
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedStuckShutdownHookTest.java
/* * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @State(Scope.Benchmark) public class ForkedStuckShutdownHookTest { @Setup public void setup() { Runtime.getRuntime().addShutdownHook( new Thread(() -> { try { TimeUnit.DAYS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }) ); } @Benchmark public void bench() throws InterruptedException { Fixtures.work(); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "expired, forcing forked VM to exit")); } }
2,633
34.12
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedStuckThreadTest.java
/* * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @State(Scope.Benchmark) public class ForkedStuckThreadTest { @Setup public void setup() { Thread t = new Thread(() -> { try { TimeUnit.DAYS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }); t.setDaemon(false); t.start(); } @Benchmark public void bench() throws InterruptedException { Fixtures.work(); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "expired, forcing forked VM to exit")); } }
2,573
33.32
88
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedThrowExceptionTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedThrowExceptionTest { @Benchmark public void bench() throws MyException { throw new MyException("Something wicked"); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "MyException")); Assert.assertTrue(Shared.contains(lines, "Something wicked")); } public static class MyException extends Exception { public MyException(String s) { super(s); } } }
2,553
35.485714
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/ForkedThrowRuntimeExceptionTest.java
/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.concurrent.TimeUnit; @Measurement(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) @Warmup(iterations = 1, time = 10, timeUnit = TimeUnit.MILLISECONDS) public class ForkedThrowRuntimeExceptionTest { @Benchmark public void bench() { throw new MyException("Something wicked"); } @Test public void test() throws RunnerException, IOException { File output = FileUtils.tempFile("output"); Shared.doRun(Fixtures.getTestMask(this.getClass()), true, output); Collection<String> lines = FileUtils.readAllLines(output); Shared.print(lines); Assert.assertTrue(Shared.contains(lines, "MyException")); Assert.assertTrue(Shared.contains(lines, "Something wicked")); } public static class MyException extends RuntimeException { public MyException(String s) { super(s); } } }
2,548
35.414286
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/errors/Shared.java
/* * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.errors; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.io.File; import java.util.Collection; public class Shared { static void doRun(String include, boolean forked, File output) throws RunnerException {Options opt = new OptionsBuilder() .include(include) .forks(forked ? 1 : 0) .shouldFailOnError(false) .output(output.getAbsolutePath()) .build(); new Runner(opt).run(); } static void print(Collection<String> lines) { for (String line : lines) { System.err.println(line); } } static boolean contains(Collection<String> lines, String s) { for (String line : lines) { if (line.contains(s)) return true; } return false; } }
2,178
34.145161
125
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/AbruptFailureTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.ThreadParams; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 60, timeUnit = TimeUnit.SECONDS) @Fork(1) @State(Scope.Benchmark) public class AbruptFailureTest { @Benchmark @Threads(4) public void test(ThreadParams tp) { if (tp.getThreadIndex() == 0) { throw new IllegalStateException(); // fail one thread } Fixtures.work(); } @Test public void invokeAPI() { long time1 = System.nanoTime(); try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected long time2 = System.nanoTime(); long delay = TimeUnit.NANOSECONDS.toSeconds(time2 - time1); Assert.assertTrue("Delayed for too long: " + delay + "s", delay < 10); } } }
2,782
34.227848
82
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingBenchmarkBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @State(Scope.Benchmark) public class FailingBenchmarkBenchSetupTest { @Setup public void setup() { Assert.fail(); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,793
32.662651
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingBenchmarkBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Benchmark) public class FailingBenchmarkBenchTearDownTest { @TearDown public void tearDown() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,809
32.855422
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingBenchmarkBenchTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Benchmark) public class FailingBenchmarkBenchTest { @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void doTest() { Assert.fail(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,683
33.857143
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingBenchmarkStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingBenchmarkStateSetupTest { @State(Scope.Benchmark) public static class MyState { @Setup public void setup() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,870
32.776471
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingBenchmarkStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingBenchmarkStateTearDownTest { @State(Scope.Benchmark) public static class MyState { @TearDown public void tearDown() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,882
32.917647
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingForkedBenchStackProfilerTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.profile.StackProfiler; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingForkedBenchStackProfilerTest { @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void doTest() { Assert.fail(); } @Test(timeout = 60*1000) public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .addProfiler(StackProfiler.class) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,839
34.5
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingForkedBenchTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingForkedBenchTest { @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void doTest() { Assert.fail(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,707
33.717949
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingForkedSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingForkedSetupTest { @Setup public void setup() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,816
32.535714
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingForkedTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingForkedTearDownTest { @TearDown public void tearDown() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,828
32.678571
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingGroupBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Group) public class FailingGroupBenchSetupTest { @Setup public void setup() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,857
32.623529
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingGroupBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Group) public class FailingGroupBenchTearDownTest { @TearDown public void tearDown() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,869
32.764706
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingGroupBenchTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Group) public class FailingGroupBenchTest { @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Group("T") @GroupThreads(4) public void doTest() { Assert.fail(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,743
33.734177
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingGroupStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingGroupStateSetupTest { @State(Scope.Group) public static class MyState { @Setup public void setup() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,930
32.689655
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingGroupStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingGroupStateTearDownTest { @State(Scope.Group) public static class MyState { @TearDown public void tearDown() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,942
32.827586
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingThreadBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingThreadBenchSetupTest { @Setup public void setup() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,791
32.638554
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingThreadBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingThreadBenchTearDownTest { @TearDown public void tearDown() { Assert.fail(); } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,803
32.783133
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingThreadBenchTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Thread) public class FailingThreadBenchTest { @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void doTest() { Assert.fail(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,677
33.779221
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingThreadStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingThreadStateSetupTest { @State(Scope.Thread) public static class MyState { @Setup public void setup() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,864
32.705882
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/FailingThreadStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ public class FailingThreadStateTearDownTest { @State(Scope.Thread) public static class MyState { @TearDown public void tearDown() { Assert.fail(); } } @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 1) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,876
32.847059
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractBenchmarkBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Benchmark) @BenchmarkMode(Mode.All) public class AbstractBenchmarkBenchSetupTest extends AbstractSetupBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,794
34.379747
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractBenchmarkBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @State(Scope.Benchmark) @BenchmarkMode(Mode.All) public class AbstractBenchmarkBenchTearDownTest extends AbstractTearDownBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,800
34.455696
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractBenchmarkStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractBenchmarkStateSetupTest { @State(Scope.Benchmark) public static class MyState extends AbstractSetupBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,848
33.743902
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractBenchmarkStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractBenchmarkStateTearDownTest { @State(Scope.Benchmark) public static class MyState extends AbstractTearDownBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,853
34.234568
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractGroupBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @State(Scope.Group) public class AbstractGroupBenchSetupTest extends AbstractSetupBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,854
34.246914
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractGroupBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @State(Scope.Group) public class AbstractGroupBenchTearDownTest extends AbstractTearDownBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,861
33.902439
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractGroupStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractGroupStateSetupTest { @State(Scope.Group) public static class MyState extends AbstractSetupBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,907
34.036145
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractGroupStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractGroupStateTearDownTest { @State(Scope.Group) public static class MyState extends AbstractTearDownBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,914
33.702381
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractSetupBase.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Setup; public abstract class AbstractSetupBase { @Setup public void setup() { Assert.fail(); } }
1,434
38.861111
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractTearDownBase.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.TearDown; public abstract class AbstractTearDownBase { @TearDown public void tearDown() { Assert.fail(); } }
1,446
39.194444
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractThreadBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @State(Scope.Thread) public class AbstractThreadBenchSetupTest extends AbstractSetupBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,788
34.303797
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractThreadBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) @State(Scope.Thread) public class AbstractThreadBenchTearDownTest extends AbstractTearDownBase { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,794
34.379747
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractThreadStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractThreadStateSetupTest { @State(Scope.Thread) public static class MyState extends AbstractSetupBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,841
34.08642
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/AbstractThreadStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class AbstractThreadStateTearDownTest { @State(Scope.Thread) public static class MyState extends AbstractTearDownBase {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,847
34.160494
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritBenchmarkBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritBenchmarkBenchSetupTest extends InheritableBenchmarkSetupState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,698
34.513158
84
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritBenchmarkBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritBenchmarkBenchTearDownTest extends InheritableBenchmarkTearDownState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,704
34.592105
90
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritBenchmarkStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritBenchmarkStateSetupTest { public static class MyState extends InheritableBenchmarkSetupState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,747
34.230769
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritBenchmarkStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritBenchmarkStateTearDownTest { public static class MyState extends InheritableBenchmarkTearDownState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,753
34.307692
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritGroupBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritGroupBenchSetupTest extends InheritableGroupSetupState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,758
34.371795
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritGroupBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritGroupBenchTearDownTest extends InheritableGroupTearDownState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,764
34.448718
82
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritGroupStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritGroupStateSetupTest { public static class MyState extends InheritableGroupSetupState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,808
33.679012
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritGroupStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Group; import org.openjdk.jmh.annotations.GroupThreads; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritGroupStateTearDownTest { public static class MyState extends InheritableGroupTearDownState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Group("T") @GroupThreads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,813
34.175
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritThreadBenchSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritThreadBenchSetupTest extends InheritableThreadSetupState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,692
34.434211
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritThreadBenchTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritThreadBenchTearDownTest extends InheritableThreadTearDownState { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test() { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,698
34.513158
84
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritThreadStateSetupTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritThreadStateSetupTest { public static class MyState extends InheritableThreadSetupState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,741
34.153846
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritThreadStateTearDownTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Baseline test: * Checks if assertions are propagated back to integration tests. */ @BenchmarkMode(Mode.All) public class InheritThreadStateTearDownTest { public static class MyState extends InheritableThreadTearDownState {} @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) @Threads(4) public void test(MyState state) { Fixtures.work(); } @Test public void invokeAPI() { try { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.fail("Should have failed"); } catch (RunnerException e) { // expected } } }
2,747
34.230769
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableBenchmarkSetupState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @State(Scope.Benchmark) public class InheritableBenchmarkSetupState { @Setup public void setup() { Assert.fail(); } }
1,546
38.666667
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableBenchmarkTearDownState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; @State(Scope.Benchmark) public class InheritableBenchmarkTearDownState { @TearDown public void tearDown() { Assert.fail(); } }
1,558
38.974359
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableGroupSetupState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @State(Scope.Group) public class InheritableGroupSetupState { @Setup public void setup() { Assert.fail(); } }
1,538
38.461538
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableGroupTearDownState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; @State(Scope.Group) public class InheritableGroupTearDownState { @TearDown public void tearDown() { Assert.fail(); } }
1,550
38.769231
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableThreadSetupState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @State(Scope.Thread) public class InheritableThreadSetupState { @Setup public void setup() { Assert.fail(); } }
1,540
38.512821
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fails/inherit/InheritableThreadTearDownState.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fails.inherit; import org.junit.Assert; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; @State(Scope.Thread) public class InheritableThreadTearDownState { @TearDown public void tearDown() { Assert.fail(); } }
1,552
38.820513
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/footprint/ForkedFootprintTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.footprint; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.openjdk.jmh.runner.options.TimeValue; public class ForkedFootprintTest { @Benchmark public void bench() { // deliberately left empty: harness should work a lot } @Test public void testBenchmark() throws RunnerException { for (Mode mode : Mode.values()) { if (mode == Mode.All) continue; Options opts = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .mode(mode) .shouldFailOnError(true) .measurementIterations(mode == Mode.SingleShotTime ? 500_000 : 1_000) .measurementTime(TimeValue.milliseconds(5)) .warmupIterations(0) .forks(1) .jvmArgs("-Xmx16m", "-Xms16m") .build(); new Runner(opts).runSingle(); } } }
2,495
37.4
89
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/AnnotatedClassForkedTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ @BenchmarkMode(Mode.All) @Fork public class AnnotatedClassForkedTest { private static volatile boolean test1executed; private static volatile boolean test2executed; @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); test1executed = true; Assert.assertFalse(test2executed); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test2() { Fixtures.work(); test2executed = true; Assert.assertFalse(test1executed); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
2,893
34.292683
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/AnnotatedForked1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ @BenchmarkMode(Mode.All) public class AnnotatedForked1_Test { private static volatile boolean test1executed; private static volatile boolean test2executed; @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); test1executed = true; Assert.assertFalse(test2executed); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(2) public void test2() { Fixtures.work(); test2executed = true; Assert.assertFalse(test1executed); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); } @Test public void invokeF_API() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
3,174
33.89011
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/AnnotatedForked2_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ @BenchmarkMode(Mode.All) public class AnnotatedForked2_Test { private static volatile boolean test1executed; private static volatile boolean test2executed; @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(1) public void test1() { Fixtures.work(); test1executed = true; Assert.assertFalse(test2executed); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(value = 2, warmups = 1) public void test2() { Fixtures.work(); test2executed = true; Assert.assertFalse(test1executed); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); } }
2,905
34.439024
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkMergeTest.java
/* * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.results.RunResult; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @Fork(5) public class ForkMergeTest { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsAppend = {"-Dbar"}) public void test() { Fixtures.work(); Assert.assertNotNull(System.getProperty("bar")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); RunResult result = new Runner(opt).runSingle(); Assert.assertEquals(5, result.getAggregatedResult().getPrimaryResult().getSampleCount()); } }
2,488
37.890625
97
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkSeparateClasspathJARTest.java
/* * Copyright (c) 2017, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.results.RunResult; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @Fork(1) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public class ForkSeparateClasspathJARTest { @Benchmark public void test() { Fixtures.work(); } @Test public void withEnabled() throws RunnerException { System.setProperty("jmh.separateClasspathJAR", "true"); Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); RunResult result = new Runner(opt).runSingle(); Assert.assertEquals(1, result.getAggregatedResult().getPrimaryResult().getSampleCount()); } @Test public void withDisabled() throws RunnerException { System.setProperty("jmh.separateClasspathJAR", "false"); Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); RunResult result = new Runner(opt).runSingle(); Assert.assertEquals(1, result.getAggregatedResult().getPrimaryResult().getSampleCount()); } }
2,915
35.911392
97
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedJvmAppendPrependArgs1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.All) public class ForkedJvmAppendPrependArgs1_Test { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dmiddle", jvmArgsAppend = "-Dappended", jvmArgsPrepend = "-Dprepended") public void test1() { Fixtures.work(); Assert.assertNotNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsAppend = "-Dappended", jvmArgsPrepend = "-Dprepended") public void test2() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsPrepend = "-Dprepended") public void test3() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsAppend = "-Dappended") public void test4() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNull(System.getProperty("prepended")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
3,896
37.584158
93
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedJvmAppendPrependArgs2_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.All) @Fork(jvmArgsAppend = "-DappendedUp", jvmArgsPrepend = "-DprependedUp") public class ForkedJvmAppendPrependArgs2_Test { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dmiddle", jvmArgsAppend = "-Dappended", jvmArgsPrepend = "-Dprepended") public void test1() { Fixtures.work(); Assert.assertNotNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); Assert.assertNull(System.getProperty("appendedUp")); Assert.assertNull(System.getProperty("prependedUp")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsAppend = "-Dappended", jvmArgsPrepend = "-Dprepended") public void test2() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); Assert.assertNull(System.getProperty("appendedUp")); Assert.assertNull(System.getProperty("prependedUp")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsPrepend = "-Dprepended") public void test3() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNull(System.getProperty("appended")); Assert.assertNotNull(System.getProperty("prepended")); Assert.assertNotNull(System.getProperty("appendedUp")); Assert.assertNull(System.getProperty("prependedUp")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgsAppend = "-Dappended") public void test4() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNotNull(System.getProperty("appended")); Assert.assertNull(System.getProperty("prepended")); Assert.assertNull(System.getProperty("appendedUp")); Assert.assertNotNull(System.getProperty("prependedUp")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork public void test5() { Fixtures.work(); Assert.assertNull(System.getProperty("middle")); Assert.assertNull(System.getProperty("appended")); Assert.assertNull(System.getProperty("prepended")); Assert.assertNotNull(System.getProperty("appendedUp")); Assert.assertNotNull(System.getProperty("prependedUp")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
4,961
39.341463
93
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedJvmArgs1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.All) public class ForkedJvmArgs1_Test { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dtest1") public void test1() { Fixtures.work(); Assert.assertNotNull(System.getProperty("test1")); Assert.assertNull(System.getProperty("test2")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dtest2") public void test2() { Fixtures.work(); Assert.assertNull(System.getProperty("test1")); Assert.assertNotNull(System.getProperty("test2")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
2,842
35.922078
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedJvmArgs2_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.All) @Fork(jvmArgs = "-DtestUpper") public class ForkedJvmArgs2_Test { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dtest1") public void test1() { Fixtures.work(); Assert.assertNotNull(System.getProperty("test1")); Assert.assertNull(System.getProperty("test2")); Assert.assertNull(System.getProperty("testUpper")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = "-Dtest2") public void test2() { Fixtures.work(); Assert.assertNull(System.getProperty("test1")); Assert.assertNotNull(System.getProperty("test2")); Assert.assertNull(System.getProperty("testUpper")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork public void testUpper() { Fixtures.work(); Assert.assertNull(System.getProperty("test1")); Assert.assertNull(System.getProperty("test2")); Assert.assertNotNull(System.getProperty("testUpper")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void testNone() { Fixtures.work(); Assert.assertNull(System.getProperty("test1")); Assert.assertNull(System.getProperty("test2")); Assert.assertNotNull(System.getProperty("testUpper")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
3,720
35.841584
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedJvmArgs3_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * tests multiply spaces in jvmArgs annotations. */ @BenchmarkMode(Mode.All) public class ForkedJvmArgs3_Test { @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = {"-Dtest1", "-Dtest3"}) public void test1() { Fixtures.work(); Assert.assertNotNull(System.getProperty("test1")); Assert.assertNull(System.getProperty("test2")); Assert.assertNotNull(System.getProperty("test3")); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) @Fork(jvmArgs = {"-Dtest2", "-Dtest3"}) public void test2() { Fixtures.work(); Assert.assertNull(System.getProperty("test1")); Assert.assertNotNull(System.getProperty("test2")); Assert.assertNotNull(System.getProperty("test3")); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } }
3,043
36.121951
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/ForkedTest.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ @BenchmarkMode(Mode.All) public class ForkedTest { private static volatile boolean test1executed; private static volatile boolean test2executed; @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); test1executed = true; Assert.assertFalse(test2executed); } @Benchmark @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test2() { Fixtures.work(); test2executed = true; Assert.assertFalse(test1executed); } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } @Test public void invokeAPI_1() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); } @Test public void invokeAPI_WF() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .warmupForks(2) .build(); new Runner(opt).run(); } }
3,471
33.376238
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_D_D_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_D_D_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,514
34.928571
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_D_F0_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_D_F0_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(0) .build(); new Runner(opt).run(); Assert.assertEquals(true, sameVM); } }
2,540
34.788732
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_D_F1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_D_F1_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,541
34.802817
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_D_F_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_D_F_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,540
34.788732
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F0_D_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F0_D_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(0) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.assertEquals(true, sameVM); } }
2,568
34.680556
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F0_F0_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F0_F0_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(0) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(0) .build(); new Runner(opt).run(); Assert.assertEquals(true, sameVM); } }
2,596
34.094595
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F0_F1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F0_F1_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(0) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,596
34.575342
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F0_F_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F0_F_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(0) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,595
34.561644
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F1_D_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F1_D_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(1) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,569
34.694444
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F1_F0_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F1_F0_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(1) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(0) .build(); new Runner(opt).run(); Assert.assertEquals(true, sameVM); } }
2,595
34.561644
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F1_F1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F1_F1_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(1) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,596
34.575342
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F1_F_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F1_F_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork(1) @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,595
34.561644
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F_D_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F_D_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,565
34.638889
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F_F0_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F_F0_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(0) .build(); new Runner(opt).run(); Assert.assertEquals(true, sameVM); } }
2,591
34.506849
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F_F1_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F_F1_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,593
34.054054
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/fork/override/ForkOverride_F_F_Test.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.fork.override; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * Tests if harness had indeed executed different tests in different JVMs. */ public class ForkOverride_F_F_Test { private static volatile boolean sameVM; @Benchmark @BenchmarkMode(Mode.All) @Fork @Warmup(iterations = 0) @Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS) public void test1() { Fixtures.work(); sameVM = true; } @Test public void invokeAPI() throws RunnerException { Options opt = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .shouldFailOnError(true) .forks(1) .build(); new Runner(opt).run(); Assert.assertEquals(false, sameVM); } }
2,591
34.506849
79
java
jmh
jmh-master/jmh-core-it/src/test/java/org/openjdk/jmh/it/infraparams/BenchmarkParamsTest.java
/* * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.jmh.it.infraparams; import org.junit.Assert; import org.junit.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.BenchmarkParams; import org.openjdk.jmh.it.Fixtures; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.CommandLineOptionException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.openjdk.jmh.runner.options.TimeValue; import java.util.Collection; import java.util.Collections; import java.util.IdentityHashMap; @State(Scope.Thread) public class BenchmarkParamsTest { Collection<BenchmarkParams> set; @Setup(Level.Iteration) public void setup() { set = Collections.synchronizedSet(Collections.newSetFromMap(new IdentityHashMap<>())); } @TearDown(Level.Iteration) public void verify() { Assert.assertEquals(1, set.size()); } @Benchmark @Threads(4) public void test(BenchmarkParams params) { set.add(params); Fixtures.work(); } @Test public void test() throws RunnerException, CommandLineOptionException { Options opts = new OptionsBuilder() .include(Fixtures.getTestMask(this.getClass())) .warmupIterations(5) .warmupTime(TimeValue.seconds(1)) .measurementIterations(5) .measurementTime(TimeValue.seconds(1)) .forks(1) .shouldFailOnError(true) .build(); new Runner(opts).run(); } }
2,826
33.901235
94
java