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

Fuzzing breaks on nested classes #1537

Closed
Domonion opened this issue Dec 16, 2022 · 1 comment · Fixed by #1552
Closed

Fuzzing breaks on nested classes #1537

Domonion opened this issue Dec 16, 2022 · 1 comment · Fixed by #1552
Assignees
Labels
ctg-bug Issue is a bug

Comments

@Domonion
Copy link
Collaborator

Description

Fuzzing break unit test generation on nested classes

To Reproduce

Steps to reproduce the behavior:

Example:

  1. Create following file
package org.example;

public class DeepNested {
    public class Nested1 {
        public class Nested2 {
            public int f(int i) {
                if (i > 0) {
                    return 10;
                }
                return 0;
            }
        }
    }
}
  1. Use plugin to generate tests

Expected behavior

Tests are supposed to be generated.

Actual behavior

Error in engine process:

java.lang.IllegalStateException: Unknown type: FuzzedType(classId=org.example.DeepNested$Nested1$Nested2, generics=[])
	at org.utbot.fuzzing.FuzzingApi.produce(Api.kt:350) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:323) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.FuzzingApi.fuzz$fuzzOne(Api.kt:250) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.FuzzingApi.access$fuzz$fuzzOne(Api.kt:1) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.FuzzingApi$fuzz$2$1.invokeSuspend(Api.kt:267) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:129) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:660) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.ProvidersKt.runFuzzing(Providers.kt:18) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.ProvidersKt.runFuzzing$default(Providers.kt:11) ~[utbot-fuzzing-2022.12-SNAPSHOT.jar:?]
	at org.utbot.fuzzing.JavaLanguageKt.runJavaFuzzing(JavaLanguage.kt:94) ~[utbot-fuzzers-2022.12-SNAPSHOT.jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$fuzzing$2.invokeSuspend(UtBotSymbolicEngine.kt:343) ~[utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$fuzzing$2.invoke(UtBotSymbolicEngine.kt) ~[utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$fuzzing$2.invoke(UtBotSymbolicEngine.kt) ~[utbot-framework-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(Collect.kt:109) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt.emitAll(Unknown Source) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:80) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:80) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(Errors.kt:156) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt.catchImpl(Unknown Source) ~[utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3$1$1.invokeSuspend(TestCaseGenerator.kt:180) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38) [utbot-core-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:157) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:156) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47) [utbot-core-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator.generate(TestCaseGenerator.kt:156) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.process.EngineProcessMainKt$setup$3.invoke(EngineProcessMain.kt:105) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.framework.process.EngineProcessMainKt$setup$3.invoke(EngineProcessMain.kt:95) [utbot-framework-2022.12-SNAPSHOT.jar:?]
	at org.utbot.rd.IdleWatchdog$wrapActiveCall$1$1.invoke(ClientProcessUtil.kt:94) [utbot-rd-2022.12-SNAPSHOT.jar:?]
	at org.utbot.rd.IdleWatchdog.wrapActive(ClientProcessUtil.kt:81) [utbot-rd-2022.12-SNAPSHOT.jar:?]
	at org.utbot.rd.IdleWatchdog$wrapActiveCall$1.invoke(ClientProcessUtil.kt:93) [utbot-rd-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:173) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:12) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:151) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:12) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase$queue$1.run(SingleThreadScheduler.kt:41) [utbot-instrumentation-2022.12-SNAPSHOT.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
	
@Domonion Domonion added the ctg-bug Issue is a bug label Dec 16, 2022
@korifey korifey moved this to Todo in UTBot Java Dec 16, 2022
@Markoutte
Copy link
Collaborator

Fuzzing cannot create objects of inner non-static classes due to this issue #761. Exception is ok in this case because it fires only once. Works as intended.

Repository owner moved this from Todo to Done in UTBot Java Dec 16, 2022
@Markoutte Markoutte reopened this Dec 16, 2022
Repository owner moved this from Done to In Progress in UTBot Java Dec 16, 2022
Repository owner moved this from In Progress to Done in UTBot Java Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants