Running first JCStress test
I'm new to JCStress and I'm trying to run the "hello world" for JCStress but facing some problems. I think there is some obvious thing that I'm missing.
I'm following this link to learn. And the samples that I'm trying are here.
I started with the template project created from the following public maven archetype:
mvn archetype:generate "-DinteractiveMode=false" "-DarchetypeGroupId=org.openjdk.jcstress" "-DarchetypeArtifactId=jcstress-java-test-archetype" "-DarchetypeVersion=0.4" "-DgroupId=org.sample" "-DartifactId=test" "-Dversion=1.0"
I did a mvn clean install
and got the .targetjcstress.jar
. I added MyConcurrencyTest
which has the following code in package org.sample
package org.sample;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.I_Result;
@JCStressTest
@Outcome(id = "1", expect = Expect.ACCEPTABLE_INTERESTING, desc = "One update lost: atomicity failure.")
@Outcome(id = "2", expect = Expect.ACCEPTABLE, desc = "Actors updated independently.")
@State
public class MyConcurrencyTest {
int v;
@Actor
public void actor1() {
v++;
}
@Actor
public void actor2() {
v++;
}
@Arbiter
public void arbiter(I_Result r) {
r.r1 = v;
}
}
The following is my project structure:
Now I'm trying to run this using this command (my current directory is the project root directory when I execute this command)
java -cp ".targetclasses" -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
But the org.sample.MyConcurrencyTest
don't get executed.
(I understand that if we don't specify the tests using -t <testname>
the tests from jcstress.jar/META-INF/TestList
are picked up.)
I think I'm missing something very obvious. Can someone please help?
(It will be great if someone could share a good starter tutorial on JCStress explaining it's capabilities and functionalities that it has)
java jcstress
add a comment |
I'm new to JCStress and I'm trying to run the "hello world" for JCStress but facing some problems. I think there is some obvious thing that I'm missing.
I'm following this link to learn. And the samples that I'm trying are here.
I started with the template project created from the following public maven archetype:
mvn archetype:generate "-DinteractiveMode=false" "-DarchetypeGroupId=org.openjdk.jcstress" "-DarchetypeArtifactId=jcstress-java-test-archetype" "-DarchetypeVersion=0.4" "-DgroupId=org.sample" "-DartifactId=test" "-Dversion=1.0"
I did a mvn clean install
and got the .targetjcstress.jar
. I added MyConcurrencyTest
which has the following code in package org.sample
package org.sample;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.I_Result;
@JCStressTest
@Outcome(id = "1", expect = Expect.ACCEPTABLE_INTERESTING, desc = "One update lost: atomicity failure.")
@Outcome(id = "2", expect = Expect.ACCEPTABLE, desc = "Actors updated independently.")
@State
public class MyConcurrencyTest {
int v;
@Actor
public void actor1() {
v++;
}
@Actor
public void actor2() {
v++;
}
@Arbiter
public void arbiter(I_Result r) {
r.r1 = v;
}
}
The following is my project structure:
Now I'm trying to run this using this command (my current directory is the project root directory when I execute this command)
java -cp ".targetclasses" -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
But the org.sample.MyConcurrencyTest
don't get executed.
(I understand that if we don't specify the tests using -t <testname>
the tests from jcstress.jar/META-INF/TestList
are picked up.)
I think I'm missing something very obvious. Can someone please help?
(It will be great if someone could share a good starter tutorial on JCStress explaining it's capabilities and functionalities that it has)
java jcstress
I figured out that after changingMyConcurrencyTest
I need to do amvn clean install
(this will addMyConcurrencyTest
into theTestList
file), and then simply runjava -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the-t
option.
– Lavish Kothari
Nov 24 '18 at 13:48
add a comment |
I'm new to JCStress and I'm trying to run the "hello world" for JCStress but facing some problems. I think there is some obvious thing that I'm missing.
I'm following this link to learn. And the samples that I'm trying are here.
I started with the template project created from the following public maven archetype:
mvn archetype:generate "-DinteractiveMode=false" "-DarchetypeGroupId=org.openjdk.jcstress" "-DarchetypeArtifactId=jcstress-java-test-archetype" "-DarchetypeVersion=0.4" "-DgroupId=org.sample" "-DartifactId=test" "-Dversion=1.0"
I did a mvn clean install
and got the .targetjcstress.jar
. I added MyConcurrencyTest
which has the following code in package org.sample
package org.sample;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.I_Result;
@JCStressTest
@Outcome(id = "1", expect = Expect.ACCEPTABLE_INTERESTING, desc = "One update lost: atomicity failure.")
@Outcome(id = "2", expect = Expect.ACCEPTABLE, desc = "Actors updated independently.")
@State
public class MyConcurrencyTest {
int v;
@Actor
public void actor1() {
v++;
}
@Actor
public void actor2() {
v++;
}
@Arbiter
public void arbiter(I_Result r) {
r.r1 = v;
}
}
The following is my project structure:
Now I'm trying to run this using this command (my current directory is the project root directory when I execute this command)
java -cp ".targetclasses" -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
But the org.sample.MyConcurrencyTest
don't get executed.
(I understand that if we don't specify the tests using -t <testname>
the tests from jcstress.jar/META-INF/TestList
are picked up.)
I think I'm missing something very obvious. Can someone please help?
(It will be great if someone could share a good starter tutorial on JCStress explaining it's capabilities and functionalities that it has)
java jcstress
I'm new to JCStress and I'm trying to run the "hello world" for JCStress but facing some problems. I think there is some obvious thing that I'm missing.
I'm following this link to learn. And the samples that I'm trying are here.
I started with the template project created from the following public maven archetype:
mvn archetype:generate "-DinteractiveMode=false" "-DarchetypeGroupId=org.openjdk.jcstress" "-DarchetypeArtifactId=jcstress-java-test-archetype" "-DarchetypeVersion=0.4" "-DgroupId=org.sample" "-DartifactId=test" "-Dversion=1.0"
I did a mvn clean install
and got the .targetjcstress.jar
. I added MyConcurrencyTest
which has the following code in package org.sample
package org.sample;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.I_Result;
@JCStressTest
@Outcome(id = "1", expect = Expect.ACCEPTABLE_INTERESTING, desc = "One update lost: atomicity failure.")
@Outcome(id = "2", expect = Expect.ACCEPTABLE, desc = "Actors updated independently.")
@State
public class MyConcurrencyTest {
int v;
@Actor
public void actor1() {
v++;
}
@Actor
public void actor2() {
v++;
}
@Arbiter
public void arbiter(I_Result r) {
r.r1 = v;
}
}
The following is my project structure:
Now I'm trying to run this using this command (my current directory is the project root directory when I execute this command)
java -cp ".targetclasses" -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
But the org.sample.MyConcurrencyTest
don't get executed.
(I understand that if we don't specify the tests using -t <testname>
the tests from jcstress.jar/META-INF/TestList
are picked up.)
I think I'm missing something very obvious. Can someone please help?
(It will be great if someone could share a good starter tutorial on JCStress explaining it's capabilities and functionalities that it has)
java jcstress
java jcstress
asked Nov 24 '18 at 12:55
Lavish KothariLavish Kothari
728614
728614
I figured out that after changingMyConcurrencyTest
I need to do amvn clean install
(this will addMyConcurrencyTest
into theTestList
file), and then simply runjava -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the-t
option.
– Lavish Kothari
Nov 24 '18 at 13:48
add a comment |
I figured out that after changingMyConcurrencyTest
I need to do amvn clean install
(this will addMyConcurrencyTest
into theTestList
file), and then simply runjava -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the-t
option.
– Lavish Kothari
Nov 24 '18 at 13:48
I figured out that after changing
MyConcurrencyTest
I need to do a mvn clean install
(this will add MyConcurrencyTest
into the TestList
file), and then simply run java -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the -t
option.– Lavish Kothari
Nov 24 '18 at 13:48
I figured out that after changing
MyConcurrencyTest
I need to do a mvn clean install
(this will add MyConcurrencyTest
into the TestList
file), and then simply run java -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the -t
option.– Lavish Kothari
Nov 24 '18 at 13:48
add a comment |
1 Answer
1
active
oldest
votes
Ah, I figured out what I was missing.
We need to do a mvn clean install
to get MyConcurrencyTest
into the META-INF/TestList
file.
Now I can run
java -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
and my test get executed. If I want to execute all the tests, I need to do
java -jar .targetjcstress.jar -v
That's it. Bingo!!
I was just missing mvn clean install
, I thought compiling the classes from Intellij and putting them on classpath will work. But it's not the case. You need to tell the JCStress framework what tests you need to execute, and for that you need to compulsorily do a mvn clean install
.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458367%2frunning-first-jcstress-test%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ah, I figured out what I was missing.
We need to do a mvn clean install
to get MyConcurrencyTest
into the META-INF/TestList
file.
Now I can run
java -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
and my test get executed. If I want to execute all the tests, I need to do
java -jar .targetjcstress.jar -v
That's it. Bingo!!
I was just missing mvn clean install
, I thought compiling the classes from Intellij and putting them on classpath will work. But it's not the case. You need to tell the JCStress framework what tests you need to execute, and for that you need to compulsorily do a mvn clean install
.
add a comment |
Ah, I figured out what I was missing.
We need to do a mvn clean install
to get MyConcurrencyTest
into the META-INF/TestList
file.
Now I can run
java -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
and my test get executed. If I want to execute all the tests, I need to do
java -jar .targetjcstress.jar -v
That's it. Bingo!!
I was just missing mvn clean install
, I thought compiling the classes from Intellij and putting them on classpath will work. But it's not the case. You need to tell the JCStress framework what tests you need to execute, and for that you need to compulsorily do a mvn clean install
.
add a comment |
Ah, I figured out what I was missing.
We need to do a mvn clean install
to get MyConcurrencyTest
into the META-INF/TestList
file.
Now I can run
java -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
and my test get executed. If I want to execute all the tests, I need to do
java -jar .targetjcstress.jar -v
That's it. Bingo!!
I was just missing mvn clean install
, I thought compiling the classes from Intellij and putting them on classpath will work. But it's not the case. You need to tell the JCStress framework what tests you need to execute, and for that you need to compulsorily do a mvn clean install
.
Ah, I figured out what I was missing.
We need to do a mvn clean install
to get MyConcurrencyTest
into the META-INF/TestList
file.
Now I can run
java -jar .targetjcstress.jar -v -t org.sample.MyConcurrencyTest
and my test get executed. If I want to execute all the tests, I need to do
java -jar .targetjcstress.jar -v
That's it. Bingo!!
I was just missing mvn clean install
, I thought compiling the classes from Intellij and putting them on classpath will work. But it's not the case. You need to tell the JCStress framework what tests you need to execute, and for that you need to compulsorily do a mvn clean install
.
answered Nov 24 '18 at 14:10
Lavish KothariLavish Kothari
728614
728614
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458367%2frunning-first-jcstress-test%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I figured out that after changing
MyConcurrencyTest
I need to do amvn clean install
(this will addMyConcurrencyTest
into theTestList
file), and then simply runjava -jar .targetjcstress.jar -v
and it will work. But I still don't know how to run a test using the-t
option.– Lavish Kothari
Nov 24 '18 at 13:48