Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple time out tests are generated by fuzzer #2595

Open
IlyaMuravjov opened this issue Sep 12, 2023 · 1 comment
Open

Multiple time out tests are generated by fuzzer #2595

IlyaMuravjov opened this issue Sep 12, 2023 · 1 comment
Labels
comp-fuzzing Issue is related to the fuzzing comp-instrumented-process Issue is related to Instrumented process ctg-bug Issue is a bug spec-regression Regression

Comments

@IlyaMuravjov
Copy link
Collaborator

Description

Since #2583 fuzzer is able to construct quite complex arguments for method under test, that can take quite some time to actually create, while instrumnted-process marks executions as timed out even if the thing that actually timed out is the argument creation prior to method under test invocation.

To Reproduce

public static boolean isNull(CharSequence charSequence) {
    if (charSequence == null) return true;
    else return false;
}

Expected behavior

Two successful test and no time out test.

Actual behavior

Two successful test and 10 time out test.

Visual proofs

public final class ClassUnderTestTest {
    ///region Test suites for executable org.example.ClassUnderTest.isNull

    ///region FUZZER: SUCCESSFUL EXECUTIONS for method isNull(java.lang.CharSequence)

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = null -> return true")
    public void testIsNullReturnsTrue() {
        boolean actual = ClassUnderTest.isNull(null);

        assertTrue(actual);
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = '10\uFFFC' (mutated from '10') -> return false")
    public void testIsNullReturnsFalseWithNonEmptyString() {
        boolean actual = ClassUnderTest.isNull("10\uFFFC");

        assertFalse(actual);
    }
    ///endregion

    ///region FUZZER: TIMEOUTS for method isNull(java.lang.CharSequence)

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        byte[] byteArray1 = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        inetAddress.getByAddress(byteArray1);
        inetAddress.getLocalHost();
        inetAddress.getByName("");
        byte[] byteArray2 = {Byte.MIN_VALUE, (byte) 0, (byte) -1};
        inetAddress.getByAddress("-3", byteArray2);
        inetAddress.getLoopbackAddress();
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull1() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        byte[] byteArray1 = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        inetAddress.getByAddress(byteArray1);
        inetAddress.getLocalHost();
        inetAddress.getByName("");
        byte[] byteArray2 = {Byte.MIN_VALUE, (byte) 0, (byte) -1};
        inetAddress.getByAddress("-3", byteArray2);
        inetAddress.getLoopbackAddress();
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull2() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        inetAddress.getByName("");
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull3() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull4() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull5() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull6() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull7() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull8() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }

    /**
     * @utbot.classUnderTest {@link ClassUnderTest}
     * @utbot.methodUnderTest {@link ClassUnderTest#isNull(CharSequence)}
     */
    @Test
    @DisplayName("isNull: arg_0 = InetAddress.getCanonicalHostName()")
    @Timeout(value = 1000L, unit = TimeUnit.MILLISECONDS)
    public void testIsNull9() throws UnknownHostException {
        byte[] byteArray = {Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE};
        InetAddress inetAddress = getByAddress(byteArray);
        String charSequence = inetAddress.getCanonicalHostName();
        
        /* This execution may take longer than the 1000 ms timeout
         and therefore fail due to exceeding the timeout. */
        assertTimeoutPreemptively(Duration.ofMillis(1000L), () -> ClassUnderTest.isNull(charSequence));
    }
    ///endregion

    ///endregion
}
@IlyaMuravjov IlyaMuravjov added ctg-bug Issue is a bug spec-regression Regression comp-fuzzing Issue is related to the fuzzing comp-instrumented-process Issue is related to Instrumented process labels Sep 12, 2023
@alisevych
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing comp-instrumented-process Issue is related to Instrumented process ctg-bug Issue is a bug spec-regression Regression
Projects
Status: Todo
Development

No branches or pull requests

2 participants