aboutsummaryrefslogtreecommitdiff
path: root/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh
blob: 4e872a1d253b264c74f47193e0c41a5189c2e9a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Evgeny Mandrikov - initial API and implementation
 *
 *******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;

String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) {
    throw new RuntimeException( "Execution should be skipped when target/classes does not exist." );
}

File dump2 = new File( basedir, "skip-child/target/jacoco.exec" );
if ( dump2.isFile() ) {
    throw new RuntimeException( "Should not be executed for module 'skip-child', but dump found : " + dump2 );
}

if ( !buildLog.contains( "argLine set to empty" ) ) {
    throw new RuntimeException( "Property not set to empty when skipping." );
}

File file = new File( basedir, "child/target/jacoco.exec" );
if ( !file.isFile() )
{
    throw new FileNotFoundException( "Could not find generated dump: " + file );
}

File xmlReport = new File( basedir, "child/target/site/jacoco/jacoco.xml" );
if ( !xmlReport.isFile() )
{
    throw new FileNotFoundException( "Could not find generated XML report: " + xmlReport );
}

File csvReport = new File( basedir, "child/target/site/jacoco/jacoco.csv" );
if ( !csvReport.isFile() )
{
    throw new FileNotFoundException( "Could not find generated CSV report: " + csvReport );
}

File htmlReport = new File( basedir, "child/target/site/jacoco/index.html" );
if ( !htmlReport.isFile() )
{
    throw new FileNotFoundException( "Could not find generated HTML report: " + htmlReport );
}