Skip to content

Commit 6f227d5

Browse files
committed
do not use main.o for Git tests
ELF analyzer uses RandomAccessFile which has troubles with closing the file on Windows. As a result main.o cannot be deleted which leads to failure of the testGetIndexDownArgs.
1 parent 7eea590 commit 6f227d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,11 @@ private void changeGitRepository(File repositoryRoot) throws Exception {
350350
assertTrue(mainFile.exists());
351351
changeFileAndCommit(git, mainFile, "new commit");
352352

353-
File rmFile = new File(repositoryRoot, "main.o");
353+
// Delete a file.
354+
final String deletedFileName = "header.h";
355+
File rmFile = new File(repositoryRoot, deletedFileName);
354356
assertTrue(rmFile.exists());
355-
git.rm().addFilepattern("main.o").call();
357+
git.rm().addFilepattern(deletedFileName).call();
356358
git.commit().setMessage("delete").setAuthor("foo", "[email protected]").setAll(true).call();
357359
assertFalse(rmFile.exists());
358360

@@ -503,7 +505,7 @@ void testGetIndexDownArgs(boolean mergeCommits, boolean renamedFiles, boolean hi
503505
assertEquals(expectedFileSet, args.works.stream().map(v -> Path.of(v.path)).collect(Collectors.toSet()));
504506

505507
assertEquals(Set.of(
506-
Path.of("/git/main.o"),
508+
Path.of("/git/header.h"),
507509
Path.of("/git/main.c"),
508510
Path.of("/git/Makefile")
509511
), listener.getRemovedFiles().stream().map(Path::of).collect(Collectors.toSet()));

0 commit comments

Comments
 (0)