|
57 | 57 | import org.junit.jupiter.api.BeforeAll;
|
58 | 58 | import org.junit.jupiter.api.BeforeEach;
|
59 | 59 | import org.junit.jupiter.api.Test;
|
| 60 | +import org.junit.jupiter.api.condition.EnabledIf; |
60 | 61 | import org.opengrok.indexer.analysis.AnalyzerFactory;
|
61 | 62 | import org.opengrok.indexer.analysis.AnalyzerGuru;
|
62 | 63 | import org.opengrok.indexer.condition.EnabledForRepository;
|
@@ -451,39 +452,32 @@ public void testIncrementalIndexAddRemoveFile() throws Exception {
|
451 | 452 | * @throws Exception
|
452 | 453 | */
|
453 | 454 | @Test
|
| 455 | + @EnabledIf("mkfifoInPath") |
454 | 456 | public void testBug11896() throws Exception {
|
| 457 | + RuntimeEnvironment env = RuntimeEnvironment.getInstance(); |
| 458 | + env.setSourceRoot(repository.getSourceRoot()); |
| 459 | + env.setDataRoot(repository.getDataRoot()); |
| 460 | + Executor executor; |
455 | 461 |
|
456 |
| - boolean test = true; |
457 |
| - if (FileUtilities.findProgInPath("mkfifo") == null) { |
458 |
| - System.out.println("Error: mkfifo not found in PATH !\n"); |
459 |
| - test = false; |
460 |
| - } |
461 |
| - |
462 |
| - if (test) { |
463 |
| - RuntimeEnvironment env = RuntimeEnvironment.getInstance(); |
464 |
| - env.setSourceRoot(repository.getSourceRoot()); |
465 |
| - env.setDataRoot(repository.getDataRoot()); |
466 |
| - Executor executor; |
467 |
| - |
468 |
| - executor = new Executor(new String[] {"mkdir", "-p", repository.getSourceRoot() + "/testBug11896"}); |
469 |
| - executor.exec(true); |
| 462 | + executor = new Executor(new String[] {"mkdir", "-p", repository.getSourceRoot() + "/testBug11896"}); |
| 463 | + executor.exec(true); |
470 | 464 |
|
471 |
| - executor = new Executor(new String[] {"mkfifo", repository.getSourceRoot() + "/testBug11896/FIFO"}); |
472 |
| - executor.exec(true); |
| 465 | + executor = new Executor(new String[] {"mkfifo", repository.getSourceRoot() + "/testBug11896/FIFO"}); |
| 466 | + executor.exec(true); |
473 | 467 |
|
474 |
| - Project project = new Project("testBug11896"); |
475 |
| - project.setPath("/testBug11896"); |
476 |
| - IndexDatabase idb = new IndexDatabase(project); |
477 |
| - assertNotNull(idb); |
478 |
| - MyIndexChangeListener listener = new MyIndexChangeListener(); |
479 |
| - idb.addIndexChangedListener(listener); |
480 |
| - System.out.println("Trying to index a special file - FIFO in this case."); |
481 |
| - idb.update(); |
482 |
| - assertEquals(0, listener.files.size()); |
| 468 | + Project project = new Project("testBug11896"); |
| 469 | + project.setPath("/testBug11896"); |
| 470 | + IndexDatabase idb = new IndexDatabase(project); |
| 471 | + assertNotNull(idb); |
| 472 | + MyIndexChangeListener listener = new MyIndexChangeListener(); |
| 473 | + idb.addIndexChangedListener(listener); |
| 474 | + System.out.println("Trying to index a special file - FIFO in this case."); |
| 475 | + idb.update(); |
| 476 | + assertEquals(0, listener.files.size()); |
| 477 | + } |
483 | 478 |
|
484 |
| - } else { |
485 |
| - System.out.println("Skipping test for bug 11896. Could not find a mkfifo in path."); |
486 |
| - } |
| 479 | + boolean mkfifoInPath() { |
| 480 | + return FileUtilities.findProgInPath("mkfifo") != null; |
487 | 481 | }
|
488 | 482 |
|
489 | 483 | /**
|
|
0 commit comments