Running first JCStress test












0















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:



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)










share|improve this question























  • 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
















0















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:



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)










share|improve this question























  • 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














0












0








0








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:



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)










share|improve this question














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:



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 12:55









Lavish KothariLavish Kothari

728614




728614













  • 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

















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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer




























      0














      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.






      share|improve this answer


























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 14:10









        Lavish KothariLavish Kothari

        728614




        728614
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'