File Coverage

blib/lib/Tapper/Schema/TestrunDB/Result/ReportSection.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Tapper::Schema::TestrunDB::Result::ReportSection;
2             our $AUTHORITY = 'cpan:TAPPER';
3             $Tapper::Schema::TestrunDB::Result::ReportSection::VERSION = '5.0.11';
4             # ABSTRACT: Tapper - Containg additional informations for reports
5              
6 7     7   3755 use strict;
  7         16  
  7         190  
7 7     7   33 use warnings;
  7         13  
  7         170  
8              
9 7     7   31 use parent 'DBIx::Class';
  7         13  
  7         37  
10              
11             # this enumeration is a bit lame. anyway: copy the list from Tapper::TAP::Harness.@SECTION_HEADER_KEYS_GENERAL.
12             # TODO: make it so (put list into schema and copy it from schema to Harness)
13             our @meta_cols = qw/ram cpuinfo bios lspci lsusb uname osname uptime language-description
14             flags kernel changeset description
15             xen-version xen-changeset xen-dom0-kernel xen-base-os-description
16             xen-guest-description xen-guest-test xen-guest-start xen-guest-flags xen-hvbits
17             kvm-module-version kvm-userspace-version kvm-kernel
18             kvm-base-os-description kvm-guest-description
19             kvm-guest-test kvm-guest-start kvm-guest-flags
20             simnow-svn-version
21             simnow-version
22             simnow-svn-repository
23             simnow-device-interface-version
24             simnow-bsd-file
25             simnow-image-file
26             ticket-url wiki-url planning-id moreinfo-url
27             tags
28             /;
29              
30             __PACKAGE__->load_components("Core");
31             __PACKAGE__->table("reportsection");
32             __PACKAGE__->add_columns
33             (
34             "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, },
35             "report_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, },
36             "succession", { data_type => "INT", default_value => undef, is_nullable => 1, size => 10, },
37             "name", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
38             # machine/os environment
39             "osname", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
40             "uname", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
41             "flags", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
42             "changeset", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
43             "kernel", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
44             "description", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
45             "language_description", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
46             "cpuinfo", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
47             "bios", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
48             "ram", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
49             "uptime", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
50             "lspci", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
51             "lsusb", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
52             # context
53             "ticket_url", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
54             "wiki_url", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
55             "planning_id", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
56             "moreinfo_url", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
57             "tags", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
58             # xen info
59             "xen_changeset", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
60             "xen_hvbits", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
61             "xen_dom0_kernel", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
62             "xen_base_os_description", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
63             "xen_guest_description", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
64             "xen_guest_flags", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
65             "xen_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
66             "xen_guest_test", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
67             "xen_guest_start", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
68             # kvm info
69             "kvm_kernel", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
70             "kvm_base_os_description", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
71             "kvm_guest_description", { data_type => "TEXT", default_value => undef, is_nullable => 1, },
72             "kvm_module_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
73             "kvm_userspace_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
74             "kvm_guest_flags", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
75             "kvm_guest_test", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
76             "kvm_guest_start", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
77             # simnow info
78             "simnow_svn_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
79             "simnow_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255 },
80             "simnow_svn_repository", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
81             "simnow_device_interface_version", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
82             "simnow_bsd_file", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
83             "simnow_image_file", { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 255, },
84             );
85              
86             __PACKAGE__->set_primary_key("id");
87              
88             __PACKAGE__->has_many ( report => 'Tapper::Schema::TestrunDB::Result::Report', { 'foreign.id' => 'self.report_id' });
89              
90              
91             # -------------------- methods on results --------------------
92              
93              
94             sub some_meta_available
95             {
96 9     9 1 6472 my ($self) = @_;
97 9         37 my %cols = $self->get_columns;
98              
99             # this enumeration is a bit lame. anyway: copy the list from Tapper::TAP::Harness.@SECTION_HEADER_KEYS_GENERAL.
100             # TODO: make it so (put list into schema and copy it from schema to Harness)
101 9         195 my @local_meta_cols = map { my $x = $_; $x =~ s/-/_/g; $x } @meta_cols;
  369         449  
  369         1002  
  369         537  
102 9 100       60 return 1 if grep { defined } @cols{@local_meta_cols};
  369         561  
103 1         10 return 0;
104             }
105              
106              
107             sub sqlt_deploy_hook
108             {
109 7     7 1 9534781 my ($self, $sqlt_table) = @_;
110 7         45 $sqlt_table->add_index(name => 'reportsection_idx_report_id', fields => ['report_id']);
111             }
112              
113              
114             1;
115              
116             __END__
117              
118             =pod
119              
120             =encoding UTF-8
121              
122             =head1 NAME
123              
124             Tapper::Schema::TestrunDB::Result::ReportSection - Tapper - Containg additional informations for reports
125              
126             =head2 some_meta_available
127              
128             Return whether there is at least one of the standard meta info headers
129             contained.
130              
131             =head2 sqlt_deploy_hook
132              
133             Add useful indexes at deploy time.
134              
135             =head1 AUTHORS
136              
137             =over 4
138              
139             =item *
140              
141             AMD OSRC Tapper Team <tapper@amd64.org>
142              
143             =item *
144              
145             Tapper Team <tapper-ops@amazon.com>
146              
147             =back
148              
149             =head1 COPYRIGHT AND LICENSE
150              
151             This software is Copyright (c) 2019 by Advanced Micro Devices, Inc..
152              
153             This is free software, licensed under:
154              
155             The (two-clause) FreeBSD License
156              
157             =cut