Ticket #1893: tt1893_quickcover.aaf80082aa.diff
| File tt1893_quickcover.aaf80082aa.diff, 12.3 KB (added by jkeenan, 2 years ago) |
|---|
-
Configure.pl
diff --git a/Configure.pl b/Configure.pl index f598cda..195ae37 100644
a b 196 196 Store the results of each configuration step in a Storable F<.sto> file on 197 197 disk, for later analysis by F<Parrot::Configure::Trace> methods. 198 198 199 =item C<--coveragedir> 200 201 In preparation for calling C<make quickcover> to perform coverage analysis, 202 provide a user-specified directory for top level of HTML output. 203 199 204 =item Operating system-specific configuration options 200 205 201 206 =over 4 -
(a) /dev/null vs. (b) b/config/auto/coverage.pm
diff --git a/config/auto/coverage.pm b/config/auto/coverage.pm new file mode 100644 index 0000000..590dd03
a b 1 # Copyright (C) 2001-2008, Parrot Foundation. 2 3 =head1 NAME 4 5 config/auto/coverage- Check whether coverage analysis tools are present 6 7 =head1 DESCRIPTION 8 9 Coverage analysis is the measurement of the extent to which a program's source 10 code is exercised by its tests. 11 12 In Parrot, we can perform coverage analysis 13 on our Parrot source code (well, at least on F<.c> and F<.pmc> files) and on 14 the Perl 5 components used in our tools. 15 16 To conduct such analysis, we need 17 the C coverage utility F<gcov> and two utilities, F<cover> and F<gcov2perl>, 18 which are included in the Devel-Cover distribution from CPAN. (Paul 19 Johnson++). This configuration step determines whether those utilities are 20 present. 21 22 =cut 23 24 package auto::coverage; 25 26 use strict; 27 use warnings; 28 29 use File::Which; 30 use base qw(Parrot::Configure::Step); 31 use Parrot::Configure::Utils ':auto'; 32 33 34 sub _init { 35 my $self = shift; 36 my %data; 37 $data{description} = q{Are coverage analysis tools installed}; 38 $data{result} = q{}; 39 return \%data; 40 } 41 42 sub runstep { 43 my ( $self, $conf ) = @_; 44 45 my %utils_needed = map { $_ => undef } qw( gcov gcov2perl cover ); 46 foreach my $util (keys %utils_needed) { 47 $utils_needed{$util} = which($util); 48 } 49 my @utils_lacking = grep { ! defined $utils_needed{$_} } keys %utils_needed; 50 if (@utils_lacking) { 51 $self->set_result("lacking @utils_lacking"); 52 } 53 else { 54 $conf->data->set( 55 "has_coverage_tools" => 1, 56 %utils_needed, 57 ); 58 $self->set_result('yes'); 59 } 60 return 1; 61 } 62 63 1; 64 65 =head1 REFERENCES 66 67 L<http://search.cpan.org/dist/Devel-Cover/>. 68 69 =cut 70 71 # Local Variables: 72 # mode: cperl 73 # cperl-indent-level: 4 74 # fill-column: 100 75 # End: 76 # vim: expandtab shiftwidth=4: -
config/auto/perldoc.pm
diff --git a/config/auto/perldoc.pm b/config/auto/perldoc.pm index 41b7f34..8ff8465 100644
a b 52 52 53 53 E_NOTE 54 54 55 opendir OPS, 'src/ops' or die "opendir ops: $!";56 my @ops = sort grep { !/^\./ && /\.ops$/ } readdir OPS;57 closedir OPS;55 opendir my $OPS, 'src/ops' or die "opendir ops: $!"; 56 my @ops = sort grep { !/^\./ && /\.ops$/ } readdir $OPS; 57 closedir $OPS; 58 58 59 59 my $TEMP_pod = join q{ } => 60 60 map { my $t = $_; $t =~ s/\.ops$/.pod/; "ops/$t" } @ops; -
config/gen/makefiles/root.in
diff --git a/config/gen/makefiles/root.in b/config/gen/makefiles/root.in index 53f691e..c7f776a 100644
a b 35 35 DOC_DIR = "@docdir@" 36 36 VERSION_DIR = "@versiondir@" 37 37 SRC_DIR = "@srcdir@" 38 COVERAGE_DIR = "@coveragedir@" 38 39 39 40 ############################################################################### 40 41 # … … 1823 1824 # The --running-make-test argument is currently used by long-running tests 1824 1825 # to disable GC_DEBUG. 1825 1826 EXTRA_TEST_ARGS = --gc-debug 1826 DISTRO_TEST_FILES = \ 1827 t/distro/*.t 1827 1828 # Directories holding tests 1829 DYNOPLIBS_TESTS_DIR = t/dynoplibs 1830 DYNPMC_TESTS_DIR = t/dynpmc 1831 INSTALL_TOOLS_TESTS_DIR = $(TOOLS_TESTS_DIR)/install 1832 OO_TESTS_DIR = t/oo 1833 OP_TESTS_DIR = t/op 1834 PIR_TESTS_DIR = t/pir 1835 PMC_TESTS_DIR = t/pmc 1836 HARNESS_TESTS_DIR = t/pharness 1837 MANIFEST_TESTS_DIR = t/manifest 1838 PMC2CUTILS_TESTS_DIR = $(TOOLS_TESTS_DIR)/pmc2cutils 1839 TOOLS_TESTS_DIR = t/tools 1840 1828 1841 BENCHMARK_TEST_FILES = \ 1829 1842 t/benchmark/*.t 1830 PERL_TEST_FILES = \ 1831 t/perl/*.t 1843 BUILDTOOLS_TEST_FILES = \ 1844 $(PMC2CUTILS_TESTS_DIR)/*.t \ 1845 $(HARNESS_TESTS_DIR)/*.t 1832 1846 CODINGSTD_TEST_FILES = \ 1833 1847 t/codingstd/*.t 1834 RUN_TEST_FILES = \1835 t/run/*.t1836 RUNCORE_TEST_FILES = \1837 --runcore-tests1838 SRC_TEST_FILES = \1839 t/src/*.t1840 TOOLS_TEST_DIR = t/tools1841 TOOLS_TEST_FILES = $(TOOLS_TEST_DIR)/tools/*.t1842 LIBRARY_TEST_FILES = @library_tests@1843 PMC2CUTILS_DIR = $(TOOLS_TEST_DIR)/pmc2cutils1844 HARNESS_DIR = t/pharness1845 BUILDTOOLS_TEST_FILES = \1846 $(PMC2CUTILS_DIR)/*.t \1847 $(HARNESS_DIR)/*.t1848 MANIFEST_DIR = t/manifest1849 INSTALL_TOOLS_DIR = $(TOOLS_TEST_DIR)/install1850 MANIFEST_TEST_FILES = \1851 $(MANIFEST_DIR)/*.t \1852 $(INSTALL_TOOLS_DIR)/*.t1853 EXAMPLES_TEST_FILES = \1854 t/examples/*.t1855 1848 CONFIGURE_TEST_FILES = \ 1856 1849 t/configure/*.t \ 1857 1850 t/steps/*.t 1851 DISTRO_TEST_FILES = \ 1852 t/distro/*.t 1853 DYNOPLIBS_TEST_FILES = $(DYNOPLIBS_TESTS_DIR)/*.t 1854 DYNPMC_TEST_FILES = $(DYNPMC_TESTS_DIR)/*.t 1855 EXAMPLES_TEST_FILES = \ 1856 t/examples/*.t 1857 HEADERIZER_TEST_FILES = $(TOOLS_TESTS_DIR)/dev/headerizer/*.t 1858 LIBRARY_TEST_FILES = @library_tests@ 1859 MANIFEST_TEST_FILES = \ 1860 $(MANIFEST_TESTS_DIR)/*.t \ 1861 $(INSTALL_TOOLS_TESTS_DIR)/*.t 1862 OO_TEST_FILES = $(OO_TESTS_DIR)/*.t 1863 OP_TEST_FILES = $(OP_TESTS_DIR)/*.t 1858 1864 PBC_TEST_FILES = \ 1859 1865 t/op/testlib/test_strings.pbc \ 1860 1866 t/pmc/testlib/annotations.pbc \ 1861 1867 t/pmc/testlib/number.pbc 1862 HEADERIZER_TEST_FILES = $(TOOLS_TEST_DIR)/dev/headerizer/*.t 1868 PERL_TEST_FILES = \ 1869 t/perl/*.t 1870 PIR_TEST_FILES = $(PIR_TESTS_DIR)/*.t 1871 PMC_TEST_FILES = $(PMC_TESTS_DIR)/*.t 1872 RUN_TEST_FILES = \ 1873 t/run/*.t 1874 RUNCORE_TEST_FILES = \ 1875 --runcore-tests 1876 SRC_TEST_FILES = \ 1877 t/src/*.t 1878 TOOLS_TEST_FILES = $(TOOLS_TESTS_DIR)/tools/*.t 1863 1879 1864 1880 # pbc files used for several tests; 1865 1881 # not needed for build, hence this target is not included in 'all' … … 1890 1906 test_core: test_prep 1891 1907 $(PERL) t/harness $(EXTRA_TEST_ARGS) 1892 1908 1909 test_runcore: test_prep 1910 $(PERL) t/harness $(EXTRA_TEST_ARGS) $(RUNCORE_TEST_FILES) 1911 1893 1912 # run the test suite, create a TAP archive and send it off to smolder 1894 1913 smolder_test : test_prep 1895 1914 $(PERL) t/harness $(EXTRA_TEST_ARGS) --archive --send-to-smolder … … 1965 1984 src_tests : 1966 1985 $(PERL) t/harness $(SRC_TEST_FILES) 1967 1986 1987 dynoplibs_tests : 1988 $(PERL) t/harness $(DYNOPLIBS_TEST_FILES) 1989 1990 dynpmc_tests : 1991 $(PERL) t/harness $(DYNPMC_TEST_FILES) 1992 1993 oo_tests : 1994 $(PERL) t/harness $(OO_TEST_FILES) 1995 1996 op_tests : 1997 $(PERL) t/harness $(OP_TEST_FILES) 1998 1999 pir_tests : 2000 $(PERL) t/harness $(PIR_TEST_FILES) 2001 2002 pmc_tests : 2003 $(PERL) t/harness $(PMC_TEST_FILES) 2004 1968 2005 # Command line and various environments 1969 2006 run_tests : 1970 2007 $(PERL) t/harness $(RUN_TEST_FILES) … … 2455 2492 | grep -v 'Source code error generation point' 2456 2493 2457 2494 COVER_FLAGS = -fprofile-arcs -ftest-coverage 2495 2458 2496 COVER_DIRS = \ 2459 2497 src \ 2460 2498 src/call \ … … 2462 2500 src/dynpmc \ 2463 2501 src/gc \ 2464 2502 src/interp \ 2503 src/io \ 2504 src/nci \ 2465 2505 src/ops \ 2466 2506 src/packfile \ 2467 2507 src/pmc \ 2468 2508 src/runcore \ 2469 2509 src/string \ 2470 2510 src/string/encoding \ 2511 frontend/parrot \ 2512 frontend/parrot_debugger \ 2513 frontend/pbc_dump \ 2514 frontend/pbc_merge \ 2471 2515 $(BUILD_DIR) \ 2472 2516 $(BUILD_DIR)/t/perl \ 2473 src/io \2474 2517 compilers/imcc 2475 2518 2476 2519 cover: \ … … 2497 2540 done 2498 2541 cover -ignore_re '^\/usr\/local\/bin' 2499 2542 2543 QUICKCOVER_DIRS = \ 2544 src \ 2545 src/call \ 2546 src/dynoplibs \ 2547 src/dynpmc \ 2548 src/gc \ 2549 src/interp \ 2550 src/io \ 2551 src/nci \ 2552 src/ops \ 2553 src/packfile \ 2554 src/pmc \ 2555 src/runcore \ 2556 src/string \ 2557 src/string/encoding \ 2558 frontend/parrot \ 2559 frontend/parrot_debugger \ 2560 frontend/pbc_dump \ 2561 frontend/pbc_merge \ 2562 compilers/imcc 2563 2564 COVER = @cover@ 2565 GCOV = @gcov@ 2566 GCOV2PERL = @gcov2perl@ 2567 2568 quickcover: \ 2569 cover.dummy \ 2570 cover-test_runcore 2571 build_dir=$$PWD; \ 2572 $(COVER) -delete; \ 2573 for dir in $(QUICKCOVER_DIRS); \ 2574 do \ 2575 cd $$dir; \ 2576 $(GCOV) *.c; \ 2577 cd $$build_dir; \ 2578 $(GCOV2PERL) -db $(COVERAGE_DIR) $$dir/*.gcov; \ 2579 done 2580 $(COVER) $(COVERAGE_DIR) -ignore_re '^\/usr\/local\/bin' 2581 2500 2582 cover.dummy: 2501 2583 $(PERL) Configure.pl --ccflags="$(CC_FLAGS) $(COVER_FLAGS)" \ 2502 2584 --linkflags="$(COVER_FLAGS)" --ldflags="$(COVER_FLAGS)" 2503 2585 2586 cover-test_runcore: cover.dummy 2587 -@make@ test_runcore 2588 2504 2589 cover-testb: cover.dummy 2505 2590 -@make@ testb 2506 2591 … … 2519 2604 cover-src: cover.dummy 2520 2605 -@make@ src_tests 2521 2606 2607 cover-dynoplibs: cover.dummy 2608 -@make@ dynoplibs_tests 2609 2610 cover-dynpmc: cover.dummy 2611 -@make@ dynpmc_tests 2612 2613 cover-oo: cover.dummy 2614 -@make@ oo_tests 2615 2616 cover-op: cover.dummy 2617 -@make@ op_tests 2618 2619 cover-pir: cover.dummy 2620 -@make@ pir_tests 2621 2622 cover-pmc: cover.dummy 2623 -@make@ pmc_tests 2624 2522 2625 cover-run: cover.dummy 2523 2626 -@make@ run_tests 2524 2627 … … 2544 2647 -@make@ distro_tests 2545 2648 2546 2649 cover-clean: 2547 $(PERL) -MCwd -e 'for my $$dir ( qw ( $(COVER_DIRS) ) ) {my $$cwd = cwd(); chdir $$dir; print "Deleting gcov-generated files in $$dir\n"; unlink glob( "*.gcda *.gcno *.gcov" ); chdir $$cwd;}'2650 $(PERL) -MCwd -e 'for my $$dir ( qw ( $(COVER_DIRS) $(QUICKCOVER_DIRS) t/src ) ) {my $$cwd = cwd(); chdir $$dir; print "Deleting gcov-generated files in $$dir\n"; unlink glob( "*.gcda *.gcno *.gcov" ); chdir $$cwd;}' 2548 2651 2549 2652 ############################################################################### 2550 2653 # -
config/init/defaults.pm
diff --git a/config/init/defaults.pm b/config/init/defaults.pm index 2d295ac..00efe0b 100644
a b 248 248 tempdir => File::Spec->tmpdir, 249 249 250 250 PKGCONFIG_DIR => $conf->options->get('pkgconfigdir') || '', 251 coveragedir => $conf->options->get('coveragedir') || $build_dir, 251 252 ); 252 253 253 254 # TT #855: Profiling options are too specific to GCC -
lib/Parrot/Configure/Options/Conf/Shared.pm
diff --git a/lib/Parrot/Configure/Options/Conf/Shared.pm b/lib/Parrot/Configure/Options/Conf/Shared.pm index 2de3a0b..05ed095 100644
a b 17 17 ccflags 18 18 ccwarn 19 19 configure_trace 20 coveragedir 20 21 cxx 21 22 darwin_no_fink 22 23 darwin_no_macports -
lib/Parrot/Configure/Step/List.pm
diff --git a/lib/Parrot/Configure/Step/List.pm b/lib/Parrot/Configure/Step/List.pm index 1bbc6d4..a0446dd 100644
a b 57 57 auto::gettext 58 58 auto::snprintf 59 59 auto::perldoc 60 auto::coverage 60 61 auto::pod2man 61 62 auto::ctags 62 63 auto::revision -
(a) /dev/null vs. (b) b/t/steps/auto/coverage-01.t
diff --git a/t/steps/auto/coverage-01.t b/t/steps/auto/coverage-01.t new file mode 100644 index 0000000..7b7d1f0
a b 1 #! perl 2 # Copyright (C) 2007, Parrot Foundation. 3 # auto/coverage-01.t 4 5 use strict; 6 use warnings; 7 use Test::More tests => 7; 8 use Carp; 9 use lib qw( lib t/configure/testlib ); 10 use_ok('config::auto::coverage'); 11 use Parrot::BuildUtil; 12 use Parrot::Configure::Options qw( process_options ); 13 use Parrot::Configure::Step::Test; 14 use Parrot::Configure::Test qw( 15 test_step_constructor_and_description 16 ); 17 18 ########## regular ########## 19 20 my ($args, $step_list_ref) = process_options( { 21 argv => [], 22 mode => q{configure}, 23 } ); 24 25 my $conf = Parrot::Configure::Step::Test->new; 26 $conf->include_config_results( $args ); 27 28 my $pkg = q{auto::coverage}; 29 30 $conf->add_steps($pkg); 31 32 my $serialized = $conf->pcfreeze(); 33 34 $conf->options->set(%{$args}); 35 my $step = test_step_constructor_and_description($conf); 36 ok($step->runstep($conf), "runstep() completed successfully"); 37 ok(defined($step->result), "Result was defined"); 38 39 pass("Completed all tests in $0"); 40 41 ################### DOCUMENTATION ################### 42 43 =head1 NAME 44 45 auto/coverage-01.t - test auto::coverage 46 47 =head1 SYNOPSIS 48 49 % prove t/steps/auto/coverage-01.t 50 51 =head1 DESCRIPTION 52 53 The files in this directory test functionality used by F<Configure.pl>. 54 55 The tests in this file test auto::coverage. 56 57 =head1 AUTHOR 58 59 James E Keenan 60 61 =head1 SEE ALSO 62 63 config::auto::coverage, F<Configure.pl>. 64 65 =cut 66 67 # Local Variables: 68 # mode: cperl 69 # cperl-indent-level: 4 70 # fill-column: 100 71 # End: 72 # vim: expandtab shiftwidth=4:
