Skip to content

Commit 84c86f2

Browse files
committed
Add buildless tests
1 parent dc9c538 commit 84c86f2

40 files changed

+681
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import sys
2+
import os.path
3+
import glob
4+
5+
def extract_fetched_jar_path(l):
6+
if not l.startswith("["):
7+
# Line continuation
8+
return None
9+
bits = l.split(" ", 3) # date time processid logline
10+
if len(bits) >= 4 and bits[3].startswith("Fetch "):
11+
return bits[3][6:].strip()
12+
else:
13+
return None
14+
15+
def read_fetched_jars(fname):
16+
with open(fname, "r") as f:
17+
lines = [l for l in f]
18+
return [l for l in map(extract_fetched_jar_path, lines) if l is not None]
19+
20+
def check_buildless_fetches():
21+
22+
extractor_logs = glob.glob(os.path.join("test-db", "log", "javac-extractor-*.log"))
23+
fetched_jars = map(read_fetched_jars, extractor_logs)
24+
all_fetched_jars = tuple(sorted([item for sublist in fetched_jars for item in sublist]))
25+
26+
try:
27+
with open("buildless-fetches.expected", "r") as f:
28+
expected_jar_fetches = tuple(l.strip() for l in f)
29+
except FileNotFoundError:
30+
expected_jar_fetches = tuple()
31+
32+
if all_fetched_jars != expected_jar_fetches:
33+
print("Expected jar fetch mismatch. Expected:\n%s\n\nActual:\n%s" % ("\n".join(expected_jar_fetches), "\n".join(all_fetched_jars)), file = sys.stderr)
34+
with open("buildless-fetches.actual", "w") as f:
35+
for j in all_fetched_jars:
36+
f.write(j + "\n")
37+
sys.exit(1)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
http://localhost:9428/releases/com/github/my/other/repo/test/otherreleasetest/1.0/otherreleasetest-1.0.jar
2+
http://localhost:9429/releases/com/github/hosted/in/other/repo/test/inotherrepo/1.0/inotherrepo-1.0.jar
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.mycompany.app</groupId>
6+
<artifactId>my-app</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
9+
<properties>
10+
<maven.compiler.source>8</maven.compiler.source>
11+
<maven.compiler.target>8</maven.compiler.target>
12+
</properties>
13+
14+
<repositories>
15+
<repository>
16+
<id>first-test-repo</id>
17+
<url>http://localhost:9428/releases</url>
18+
</repository>
19+
</repositories>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>com.github.my.other.repo.test</groupId>
24+
<artifactId>otherreleasetest</artifactId>
25+
<version>1.0</version>
26+
</dependency>
27+
</dependencies>
28+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff29cc2e7c14353abbfddd2356672fa3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f1e9185fe95c430181ddf79643794ea3762239c4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.github.my.other.repo.test</groupId>
6+
<artifactId>otherreleasetest</artifactId>
7+
<version>1.0</version>
8+
9+
<repositories>
10+
<repository>
11+
<id>second-test-repo</id>
12+
<url>http://localhost:9429/releases</url>
13+
</repository>
14+
</repositories>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>com.github.hosted.in.other.repo.test</groupId>
19+
<artifactId>inotherrepo</artifactId>
20+
<version>1.0</version>
21+
</dependency>
22+
</dependencies>
23+
</project>
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fb11c1bdba89ffd4a2bedc9c79fe7d66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
787d45cbeba15d9e29cdd446234497df84138458

0 commit comments

Comments
 (0)