Disabling unit tests when running with -Dnative

24 views
Skip to first unread message

Foivos Zakkak

unread,
Jul 15, 2020, 12:02:45 PM7/15/20
to Quarkus Development mailing list
Hello,

Since -Dnative is meant to be used only for integration testing and is
used in a separate step in CI to only test native compilation, would it
be OK to skip unit tests when active?

One can achieve this with something like:

diff --git a/integration-tests/artemis-core/pom.xml
b/integration-tests/artemis-core/pom.xml
index 23ead6449e..c184584026 100644
--- a/integration-tests/artemis-core/pom.xml
+++ b/integration-tests/artemis-core/pom.xml
@@ -112,6 +112,13 @@
             </activation>
             <build>
                 <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <skipTests>true</skipTests>
+                        </configuration>
+                    </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-failsafe-plugin</artifactId>

Regards,
Foivos

signature.asc

Guillaume Smet

unread,
Jul 15, 2020, 12:06:25 PM7/15/20
to fza...@redhat.com, Quarkus Development mailing list
I don't know.

Frankly, when running the native tests, I'm usually happy the other tests run before that so I don't waste my time on native compilation if a test fails in JVM mode.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/b04c930b-7d99-be8e-2db1-2540420b64ec%40redhat.com.

Georgios Andrianakis

unread,
Jul 15, 2020, 12:17:23 PM7/15/20
to Guillaume Smet, Foivos Zakkak, Quarkus Development mailing list


On Wed, Jul 15, 2020, 19:06 Guillaume Smet <guillau...@gmail.com> wrote:
I don't know.

Frankly, when running the native tests, I'm usually happy the other tests run before that so I don't waste my time on native compilation if a test fails in JVM mode.

+1 on this. When I run the native tests locally, I almost always also want the regular tests to run.

Foivos Zakkak

unread,
Jul 15, 2020, 12:37:58 PM7/15/20
to Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

I see.

How about something like -Dskip.native.surefire and



diff --git a/integration-tests/artemis-core/pom.xml
b/integration-tests/artemis-core/pom.xml
index 23ead6449e..c184584026 100644
--- a/integration-tests/artemis-core/pom.xml
+++ b/integration-tests/artemis-core/pom.xml
@@ -112,6 +112,13 @@
             </activation>
             <build>
                 <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>

+                            <skipTests>${skip.native.surefire}</skipTests>


+                        </configuration>
+                    </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-failsafe-plugin</artifactId>

Foivos
signature.asc

Georgios Andrianakis

unread,
Jul 15, 2020, 1:30:48 PM7/15/20
to Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
Which you would activate in CI or something?

Foivos Zakkak

unread,
Jul 15, 2020, 1:44:29 PM7/15/20
to Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

Yes, that's my prime goal.

Of course it can also be used locally if someone wants to skip unit tests when running with -Dnative or -Pnative-image

signature.asc

Georgios Andrianakis

unread,
Jul 15, 2020, 3:43:22 PM7/15/20
to Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
I assume though in that case the normal -DskipTests wouldn't work, would it?

Foivos Zakkak

unread,
Jul 15, 2020, 3:48:47 PM7/15/20
to Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

You mean in combination with -Dnative. Right?
Yes, it wouldn't unless we add something like:

<properties>
    <skip.native.surefire>${skipTests}</skip.native.surefire>
</properties>
signature.asc

Georgios Andrianakis

unread,
Jul 15, 2020, 4:12:01 PM7/15/20
to Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
Okay, so the idea is to add this only to the native profile?

Foivos Zakkak

unread,
Jul 15, 2020, 4:24:16 PM7/15/20
to Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

Yes. Sorry, it was not obvious from the diff.
What I am proposing targets only the native-image profile in the integration-tests directory/module.

To achieve it I think I need to add:

1. in integration-tests/pom.xml:

+            <properties>

+                <skip.native.surefire>${skipTests}</skip.native.surefire>
+            </properties>

2. in integration-tests/*/pom.xml:

    <profiles>
        <profile>
            <id>native-image</id>
            <activation>
                <property>
                    <name>native</name>
                </property>

            </activation>
            <build>
                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <skipTests>${skip.native.surefire}</skipTests>
+                        </configuration>
+                    </plugin>
                    <plugin>
...
signature.asc

Georgios Andrianakis

unread,
Jul 15, 2020, 4:25:14 PM7/15/20
to Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
I am personally fine with that

Jason Greene

unread,
Jul 15, 2020, 4:55:24 PM7/15/20
to Georgios Andrianakis, Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
Wait. Doesn’t this do the opposite? Like I thought -DskipTests works now, and with this b approach -DskipTests won’t actually skip the native tests. That’s not good.

Jason Greene

unread,
Jul 15, 2020, 4:58:17 PM7/15/20
to Georgios Andrianakis, Foivos Zakkak, Guillaume Smet, Quarkus Development mailing list
Ah nevermind, I misread the change in 1. Ok so basically -DskipTests disables everything but you can override just the native portion with -Dskip.native.surefire
?

Foivos Zakkak

unread,
Jul 15, 2020, 5:01:16 PM7/15/20
to Jason Greene, Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

Exactly

signature.asc

Jason Greene

unread,
Jul 15, 2020, 5:04:20 PM7/15/20
to Foivos Zakkak, Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list
Ok yeah that sounds good then.

Foivos Zakkak

unread,
Jul 15, 2020, 5:09:20 PM7/15/20
to Jason Greene, Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list

Let me give some examples for clarity:

1. `mvn -Dskip.native.surefire verify` runs both unit tests and integration tests (no native tests here), it's essentially the same with `mvn verify`.

2. `mvn -DskipTests verify` runs neither the unit tests nor the integration tests (no native tests here)

3. `mvn -DskipITs verify` runs unit tests but not integration tests (no native tests here)

4. `mvn -Dnative verify` runs the unit tests (jvm-mode) and the integration tests in native mode

5. `mvn -Dnative -DskipTests verify` runs neither the unit test nor the integration tests (but builds the native image for each integration test)

6. `mvn -Dnative -DskipITs verify` runs the unit tests (jvm-mode) but not the integration tests (still builds the native image for each integration test)

7. `mvn -Dnative -Dskip.native.surefire verify` runs only the integration tests in native mode

Foivos

signature.asc

Alexey Loubyansky

unread,
Jul 16, 2020, 12:12:42 PM7/16/20
to fza...@redhat.com, Jason Greene, Georgios Andrianakis, Guillaume Smet, Quarkus Development mailing list
That makes sense, imo.

Reply all
Reply to author
Forward
0 new messages