Skip to content

Commit 0c197be

Browse files
committed
Merge remote-tracking branch 'origin/master' into regex-support-extension
# Conflicts: # core-tests/e2e-tests/spring/emb-json/src/test/java/org/evomaster/e2etests/emb/json/language/LanguageServerExampleEMTest.java # core/src/main/antlr4/org/evomaster/core/parser/RegexJava.g4 # core/src/main/kotlin/org/evomaster/core/parser/GeneRegexJavaVisitor.kt # core/src/main/kotlin/org/evomaster/core/search/gene/regex/CharacterClassEscapeRxGene.kt # core/src/main/kotlin/org/evomaster/core/search/gene/regex/CharacterRangeRxGene.kt # core/src/main/kotlin/org/evomaster/core/search/service/Randomness.kt
2 parents 5ac1817 + f725838 commit 0c197be

169 files changed

Lines changed: 4126 additions & 599 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
# - "**"
3232

3333
env:
34-
evomaster-version: 5.0.3
34+
evomaster-version: 5.1.1
3535
# Unfortunately, to use JPackage we need JDK 17 or above :(
3636
# Which is really bad due to the madness of --add-opens.
3737
# Even if hunt down all cases of reflections in EM, there is still the problem of

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- "v*"
99

1010
env:
11-
evomaster-version: 5.0.3
11+
evomaster-version: 5.1.1
1212
jdk-jar: 17
1313
jdk-jpackage: 21
1414
retention-days: 1
@@ -55,11 +55,16 @@ jobs:
5555
with:
5656
username: ${{ secrets.DOCKERHUB_USERNAME }}
5757
password: ${{ secrets.DOCKERHUB_PASSWORD }}
58+
- name: Set up QEMU
59+
uses: docker/setup-qemu-action@v4
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v4
5862
- name: Build and push Docker
5963
uses: docker/build-push-action@v5
6064
with:
6165
context: .
6266
push: true
67+
platforms: linux/amd64,linux/arm64
6368
tags: ${{ steps.meta.outputs.tags }}
6469
labels: ${{ steps.meta.outputs.labels }}
6570

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# EvoMaster: A Tool For Automatically Generating System-Level Test Cases
22

33

4-
![](docs/img/carl-cerstrand-136810_compressed.jpg "Photo by Carl Cerstrand on Unsplash")
4+
[//]: # (![](docs/img/carl-cerstrand-136810_compressed.jpg "Photo by Carl Cerstrand on Unsplash"))
55

66
[![Maven Central](https://img.shields.io/maven-central/v/org.evomaster/evomaster-client-java.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.evomaster/evomaster-client-java)
77
[![javadoc](https://javadoc.io/badge2/org.evomaster/evomaster-client-java-controller/javadoc.svg)](https://javadoc.io/doc/org.evomaster/evomaster-client-java-controller)
@@ -12,8 +12,14 @@
1212
[![Github All Releases](https://img.shields.io/github/downloads/WebFuzzing/evomaster/total.svg)](https://github.com/WebFuzzing/EvoMaster/releases)
1313

1414

15+
1516
### Summary
1617

18+
[//]: # (<div style="float: left; margin-right: 15px; margin-bottom: 10px;">)
19+
<img align="left" src="docs/img/em_mascot.png" alt="AI-generated mascot, with Bing" width="100" />
20+
21+
[//]: # (</div>)
22+
1723
_EvoMaster_ ([www.evomaster.org](http://evomaster.org)) is the first (2016) open-source AI-driven tool
1824
that automatically *generates* system-level test cases
1925
for web/enterprise applications.
@@ -123,10 +129,9 @@ Note, since version 4.0.0, now _EvoMaster_ by default also creates an interactiv
123129

124130
* _State-of-the-art_: an [independent study (2022)](https://arxiv.org/abs/2204.08348), comparing 10 fuzzers on 20 RESTful APIs, shows that _EvoMaster_ gives the best results. Another [independent study (2024)](https://arxiv.org/abs/2410.12547) done by a different research group confirms these results.
125131

126-
* _Schema_: REST APIs must provide a schema in [OpenAPI/Swagger](https://swagger.io)
127-
format (either _v2_ or _v3_).
132+
* _Schema_: REST APIs must provide a schema in [OpenAPI format](https://www.openapis.org/). We support versions _2.0_, _3.0_ and _3.1_. Unfortunately, support for version _3.2_ is currently on hold due to [swagger-parser](https://github.com/swagger-api/swagger-parser/issues/2248).
128133

129-
* _Output_: the tool generates _JUnit_ (version 4 or 5) tests, written in either Java or Kotlin, as well as test suites in Python and JavaScript. For a complete list, see the documentation for the CLI parameter [--outputFormat](docs/options.md).
134+
* _Output_: the tool generates _JUnit_ (version 4 or 5) tests, written in either _Java_ or _Kotlin_, as well as test suites in _Python_ and _JavaScript_. For a complete list, see the documentation for the CLI parameter [--outputFormat](docs/options.md).
130135
Some examples are: PYTHON_UNITTEST, KOTLIN_JUNIT_5, JAVA_JUNIT_4 and JS_JEST.
131136
Note that the generated tests rely on third-party libraries (e.g., to make HTTP calls).
132137
These will need to be setup in your projects, [see documentation](docs/library_dependencies.md).

client-java/ci-utils/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<parent>
1414
<artifactId>evomaster-client-java</artifactId>
1515
<groupId>org.evomaster</groupId>
16-
<version>5.0.3-SNAPSHOT</version>
16+
<version>5.1.1-SNAPSHOT</version>
1717
</parent>
1818

1919
<artifactId>evomaster-ci-utils</artifactId>

client-java/client-util/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.evomaster</groupId>
77
<artifactId>evomaster-client-java</artifactId>
8-
<version>5.0.3-SNAPSHOT</version>
8+
<version>5.1.1-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>evomaster-client-java-util</artifactId>

client-java/controller-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.evomaster</groupId>
77
<artifactId>evomaster-client-java</artifactId>
8-
<version>5.0.3-SNAPSHOT</version>
8+
<version>5.1.1-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>evomaster-client-java-controller-api</artifactId>

client-java/controller/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.evomaster</groupId>
77
<artifactId>evomaster-client-java</artifactId>
8-
<version>5.0.3-SNAPSHOT</version>
8+
<version>5.1.1-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>evomaster-client-java-controller</artifactId>

client-java/controller/src/main/java/org/evomaster/client/java/controller/internal/db/redis/RedisHandler.java

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package org.evomaster.client.java.controller.internal.db.redis;
22

33
import org.evomaster.client.java.controller.internal.TaintHandlerExecutionTracer;
4+
import org.evomaster.client.java.controller.redis.RedisKeyValueStore;
45
import org.evomaster.client.java.controller.redis.ReflectionBasedRedisClient;
56
import org.evomaster.client.java.controller.redis.RedisHeuristicsCalculator;
6-
import org.evomaster.client.java.controller.redis.RedisInfo;
7+
import org.evomaster.client.java.controller.redis.RedisValueData;
78
import org.evomaster.client.java.instrumentation.RedisCommand;
89
import org.evomaster.client.java.utils.SimpleLogger;
910

@@ -82,35 +83,34 @@ private RedisDistanceWithMetrics computeDistance(RedisCommand redisCommand, Refl
8283
switch (type) {
8384
case KEYS:
8485
case EXISTS: {
85-
List<RedisInfo> redisInfo = createRedisInfoForAllKeys(redisClient);
86-
return calculator.computeDistance(redisCommand, redisInfo);
86+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForAllKeys(redisClient);
87+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
8788
}
8889

8990
case GET: {
90-
List<RedisInfo> redisInfo = createRedisInfoForKeysByType(REDIS_STRING_TYPE, redisClient);
91-
return calculator.computeDistance(redisCommand, redisInfo);
91+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForKeysByType(REDIS_STRING_TYPE, redisClient);
92+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
9293
}
9394

9495
case HGET: {
95-
String field = redisCommand.extractArgs().get(1);
96-
List<RedisInfo> redisInfo = createRedisInfoForKeysByField(field, redisClient);
97-
return calculator.computeDistance(redisCommand, redisInfo);
96+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForKeysByField(redisClient);
97+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
9898
}
9999

100100
case HGETALL: {
101-
List<RedisInfo> redisInfo = createRedisInfoForKeysByType(REDIS_HASH_TYPE, redisClient);
102-
return calculator.computeDistance(redisCommand, redisInfo);
101+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForKeysByType(REDIS_HASH_TYPE, redisClient);
102+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
103103
}
104104

105105
case SMEMBERS: {
106-
List<RedisInfo> redisInfo = createRedisInfoForKeysByType(REDIS_SET_TYPE, redisClient);
107-
return calculator.computeDistance(redisCommand, redisInfo);
106+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForKeysByType(REDIS_SET_TYPE, redisClient);
107+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
108108
}
109109

110110
case SINTER: {
111111
List<String> keys = redisCommand.extractArgs();
112-
List<RedisInfo> redisInfo = createRedisInfoForIntersection(keys, redisClient);
113-
return calculator.computeDistance(redisCommand, redisInfo);
112+
RedisKeyValueStore redisKeyValueStore = createRedisInfoForIntersection(keys, redisClient);
113+
return calculator.computeDistance(redisCommand, redisKeyValueStore);
114114
}
115115

116116
default:
@@ -122,35 +122,48 @@ private RedisDistanceWithMetrics computeDistance(RedisCommand redisCommand, Refl
122122
}
123123
}
124124

125-
private List<RedisInfo> createRedisInfoForIntersection(List<String> keys, ReflectionBasedRedisClient redisClient) {
126-
List<RedisInfo> redisData = new ArrayList<>();
127-
keys.forEach(
128-
key -> redisData.add(new RedisInfo(key, redisClient.getType(key), redisClient.getSetMembers(key))
125+
private RedisKeyValueStore createRedisInfoForIntersection(List<String> commandKeys, ReflectionBasedRedisClient redisClient) {
126+
Set<String> keySet = redisClient.getKeysByType(REDIS_SET_TYPE);
127+
128+
//A Map structure is introduced here using the same keys that are stored in REDIS.
129+
//The value for each one, since each key represents a SET, correspond to the members of that given set.
130+
Map<String, RedisValueData> redisData = new HashMap<>();
131+
keySet.forEach(
132+
key -> redisData.put(key, new RedisValueData(redisClient.getSetMembers(key))
129133
));
130-
return redisData;
134+
return new RedisKeyValueStore(redisData);
131135
}
132136

133-
private List<RedisInfo> createRedisInfoForAllKeys(ReflectionBasedRedisClient redisClient) {
137+
private RedisKeyValueStore createRedisInfoForAllKeys(ReflectionBasedRedisClient redisClient) {
134138
Set<String> keys = redisClient.getAllKeys();
135-
List<RedisInfo> redisData = new ArrayList<>();
139+
140+
//A Map structure is introduced here using the same keys that are stored in REDIS.
141+
//No value is needed in this case.
142+
Map<String, RedisValueData> redisData = new HashMap<>();
136143
keys.forEach(
137-
key -> redisData.add(new RedisInfo(key))
144+
key -> redisData.put(key, null)
138145
);
139-
return redisData;
146+
return new RedisKeyValueStore(redisData);
140147
}
141148

142-
private List<RedisInfo> createRedisInfoForKeysByType(String type, ReflectionBasedRedisClient redisClient) {
149+
private RedisKeyValueStore createRedisInfoForKeysByType(String type, ReflectionBasedRedisClient redisClient) {
143150
Set<String> keys = redisClient.getKeysByType(type);
144-
List<RedisInfo> redisData = new ArrayList<>();
145-
keys.forEach(key -> redisData.add(new RedisInfo(key)));
146-
return redisData;
151+
152+
//A Map structure is introduced here using the same keys that are stored in REDIS.
153+
//No value is needed in this case.
154+
Map<String, RedisValueData> redisData = new HashMap<>();
155+
keys.forEach(key -> redisData.put(key, null));
156+
return new RedisKeyValueStore(redisData);
147157
}
148158

149-
private List<RedisInfo> createRedisInfoForKeysByField(String field, ReflectionBasedRedisClient redisClient) {
159+
private RedisKeyValueStore createRedisInfoForKeysByField(ReflectionBasedRedisClient redisClient) {
150160
Set<String> keys = redisClient.getKeysByType(REDIS_HASH_TYPE);
151-
List<RedisInfo> redisData = new ArrayList<>();
152-
keys.forEach(key -> redisData.add(new RedisInfo(key, redisClient.getHashFields(key))));
153-
return redisData;
161+
162+
//A Map structure is introduced here using the same keys that are stored in REDIS.
163+
//The value for each one, since each key is of type HASH, correspond to the fields stored for that given key.
164+
Map<String, RedisValueData> redisData = new HashMap<>();
165+
keys.forEach(key -> redisData.put(key, new RedisValueData(redisClient.getHashFields(key))));
166+
return new RedisKeyValueStore(redisData);
154167
}
155168

156169
public void setRedisClient(ReflectionBasedRedisClient redisClient) {

0 commit comments

Comments
 (0)