File Coverage

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