[SCM] ci-tooling packaging branch, master, updated. c8bb08da4d11808da041234b3a3a9fac9332fb62
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Tue Apr 28 12:23:00 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=c8bb08d
The following commit has been merged in the master branch:
commit c8bb08da4d11808da041234b3a3a9fac9332fb62
Author: Harald Sitter <sitter at kde.org>
Date: Tue Apr 28 14:22:51 2015 +0200
refactor the entire log linting into actual classes and the lint framework
---
lib/lint/log.rb | 25 ++++++
lib/lint/log/build_log_segmenter.rb | 14 ++++
lib/lint/log/cmake.rb | 94 ++++++++++++++++++++++
lib/lint/log/lintian.rb | 67 +++++++++++++++
lib/lint/log/list_missing.rb | 22 +++++
lib/lint/log/symbols.rb | 9 +++
.../test_disabled_feature | 0
.../test_init | 0
.../test_missing_package | 0
.../test_optional | 0
.../test_warning | 0
test/data/test_lint_lintian/test_invalid | 31 +++++++
test/data/test_lint_lintian/test_lint | 41 ++++++++++
test/data/test_lint_list_missing/test_invalid | 31 +++++++
test/data/test_lint_list_missing/test_lint | 43 ++++++++++
.../test_lint} | 45 ++++++++++-
test/test_lint_cmake.rb | 43 ++++++++++
test/test_lint_lintian.rb | 18 +++++
test/test_lint_list_missing.rb | 18 +++++
test/test_lint_log.rb | 36 +++++++++
20 files changed, 536 insertions(+), 1 deletion(-)
diff --git a/lib/lint/log.rb b/lib/lint/log.rb
new file mode 100644
index 0000000..5228a5c
--- /dev/null
+++ b/lib/lint/log.rb
@@ -0,0 +1,25 @@
+require_relative 'result'
+require_relative 'log/cmake'
+require_relative 'log/lintian'
+require_relative 'log/list_missing'
+
+module Lint
+ # Lints a build log
+ class Log
+ attr_reader :log_data
+
+ def initialize(log_data)
+ @log_data = log_data
+ end
+
+ # @return [Array<Result>]
+ def lint
+ results = []
+ [CMake, Lintian, ListMissing].each do |klass|
+ results << klass.new.lint(@log_data.clone)
+ end
+ # FIXME: symbols handling not implemented
+ results
+ end
+ end
+end
diff --git a/lib/lint/log/build_log_segmenter.rb b/lib/lint/log/build_log_segmenter.rb
new file mode 100644
index 0000000..f848469
--- /dev/null
+++ b/lib/lint/log/build_log_segmenter.rb
@@ -0,0 +1,14 @@
+# Split a segment out of a build log by defining a start maker and an end marker
+module BuildLogSegmenter
+ module_function
+
+ def segmentify(data, start_marker, end_marker)
+ start_index = data.index(start_marker)
+ end_index = data.index(end_marker)
+ return [] unless start_index && end_index
+ data = data.slice(start_index..end_index).split("
")
+ data.shift # Ditch start line
+ data.pop # Ditch end line
+ data
+ end
+end
diff --git a/lib/lint/log/cmake.rb b/lib/lint/log/cmake.rb
new file mode 100644
index 0000000..c3d5927
--- /dev/null
+++ b/lib/lint/log/cmake.rb
@@ -0,0 +1,94 @@
+require_relative '../result'
+require_relative 'build_log_segmenter'
+
+module Lint
+ class Log
+ # Parses CMake output
+ # FIXME: presently we simply result with names, this however lacks context
+ # in the log then, so the output should be changed to a descriptive
+ # line
+ class CMake
+ include BuildLogSegmenter
+
+ METHS = {
+ 'The following OPTIONAL packages have not been found' \
+ => :parse_summary,
+ 'The following features have been disabled' \
+ => :parse_summary,
+ 'Could not find a package configuration file provided by' \
+ => :parse_package,
+ 'CMake Warning' \
+ => :parse_warning
+ }
+
+ def lint(data)
+ r = Result.new
+ data = segmentify(data, 'dh_auto_configure', 'dh_auto_build')
+ r.valid = !data.empty?
+ parse(data, r)
+ r.informations.uniq!
+ r.warnings.uniq!
+ r.errors.uniq!
+ r
+ end
+
+ private
+
+ def parse(data, result)
+ until data.empty?
+ line = data.shift
+ METHS.each do |id, meth|
+ next unless line.include?(id)
+ result.warnings += send(meth, line, data)
+ break
+ end
+ end
+ end
+
+ def parse_summary(_line, data)
+ missing = []
+ start_line = false
+ until data.empty?
+ line = data.shift
+ if !start_line && line.empty?
+ start_line = true
+ next
+ elsif start_line && !line.empty?
+ next if line.strip.empty?
+ match = line.match(/^ *\* (.*)$/)
+ missing << match[1] if match && match.size > 1
+ else
+ # Line is empty and the start conditions didn't match.
+ # Either the block is not valid or we have reached the end.
+ # In any case, break here.
+ break
+ end
+ end
+ missing
+ end
+
+ def parse_package(line, _data)
+ package = 'Could not find a package configuration file provided by'
+ match = line.match(/^\s+#{package}\s+"(.+)"/)
+ return [] unless match && match.size > 1
+ [match[1]]
+ end
+
+ def parse_warning(line, _data)
+ warn 'CMake Warning Parsing is disabled at this time!'
+ return [] unless line.include?('CMake Warning')
+ # Lines coming from MacroOptionalFindPackage (from old parsing).
+ return [] if line.include?('CMake Warning at /usr/share/kde4/apps/cmake/' \
+ 'modules/MacroOptionalFindPackage.cmake')
+ # Lines coming from find_package (from old parsing).
+ return [] if line.match(/CMake Warning at [^ :]+:\d+ \(find_package\)/)
+ # Lines coming from warnings inside the actual CMakeLists.txt as those can
+ # be arbitrary.
+ # ref: "CMake Warning at src/worker/CMakeLists.txt:33 (message):"
+ return [] if line.match(/CMake Warning at [^ :]*CMakeLists.txt:\d+ \(message\)/)
+ return [] if line.start_with?('CMake Warning (dev)')
+ [] # if line.start_with?('CMake Warning:')] ALWAYS empty, too pointless
+ end
+ end
+ end
+end
diff --git a/lib/lint/log/lintian.rb b/lib/lint/log/lintian.rb
new file mode 100644
index 0000000..693f62e
--- /dev/null
+++ b/lib/lint/log/lintian.rb
@@ -0,0 +1,67 @@
+require_relative '../result'
+require_relative 'build_log_segmenter'
+
+module Lint
+ class Log
+ class Lintian
+ include BuildLogSegmenter
+
+ EXCLUSION = [
+ # Package names can easily go beyond what shit can suck on, so gag it.
+ 'source-package-component-has-long-file-name',
+ 'package-has-long-file-name',
+ # We really do not care about standards versions for now. They only ever
+ # get bumped by the pkg-kde team anyway.
+ 'out-of-date-standards-version',
+ 'newer-standards-version',
+ # We package an enormous amount of GUI apps without manpages (in fact
+ # they arguably wouldn't even make sense what with being GUI apps). So
+ # ignore any and all manpage warnings to save Harald from having to
+ # override them in every single application repository.
+ 'binary-without-manpage'
+ ]
+
+ def lint(data)
+ r = Result.new
+ data = segmentify(data, "=== Start lintian
", "=== End lintian
")
+ r.valid = !data.empty?
+ data.each do |line|
+ lint_line(line, r)
+ end
+ r
+ end
+
+ private
+
+ def exclude?(line)
+ # Always exclude random warnings from lintian itself.
+ return true if line.start_with?('warning: ')
+ EXCLUSION.each do |e|
+ next unless line.include?(e)
+ return true
+ end
+ false
+ end
+
+ def lint_line(line, result)
+ return if exclude?(line)
+
+# FIXME: symbols
+ # # Do not print symbols warnings if we already auto-updated.
+ # if args[:updated_symbols] &&
+ # line.include?('symbols-file-contains-current-version-with-debian-revision')
+ # next
+ # end
+
+ case line[0..1]
+ when 'W:'
+ result.warnings << line
+ when 'E:'
+ result.errors << line
+ else
+ result.informations << line
+ end
+ end
+ end
+ end
+end
diff --git a/lib/lint/log/list_missing.rb b/lib/lint/log/list_missing.rb
new file mode 100644
index 0000000..fd7fa28
--- /dev/null
+++ b/lib/lint/log/list_missing.rb
@@ -0,0 +1,22 @@
+require_relative '../result'
+require_relative 'build_log_segmenter'
+
+module Lint
+ class Log
+ class ListMissing
+ include BuildLogSegmenter
+
+ def lint(data)
+ r = Result.new
+ data = segmentify(data,
+ "=== Start list-missing
",
+ "=== End list-missing
")
+ r.valid = !data.empty?
+ data.each do |line|
+ r.errors << line
+ end
+ r
+ end
+ end
+ end
+end
diff --git a/lib/lint/log/symbols.rb b/lib/lint/log/symbols.rb
new file mode 100644
index 0000000..461f07e
--- /dev/null
+++ b/lib/lint/log/symbols.rb
@@ -0,0 +1,9 @@
+require_relative 'build_log_segmenter'
+
+module Lint
+ class Log
+ class Symbols
+ include BuildLogSegmenter
+ end
+ end
+end
diff --git a/test/data/test_cmake_parser/test_disabled_feature b/test/data/test_lint_cmake/test_disabled_feature
similarity index 100%
copy from test/data/test_cmake_parser/test_disabled_feature
copy to test/data/test_lint_cmake/test_disabled_feature
diff --git a/test/data/test_cmake_parser/test_init b/test/data/test_lint_cmake/test_init
similarity index 100%
copy from test/data/test_cmake_parser/test_init
copy to test/data/test_lint_cmake/test_init
diff --git a/test/data/test_cmake_parser/test_missing_package b/test/data/test_lint_cmake/test_missing_package
similarity index 100%
copy from test/data/test_cmake_parser/test_missing_package
copy to test/data/test_lint_cmake/test_missing_package
diff --git a/test/data/test_cmake_parser/test_optional b/test/data/test_lint_cmake/test_optional
similarity index 100%
copy from test/data/test_cmake_parser/test_optional
copy to test/data/test_lint_cmake/test_optional
diff --git a/test/data/test_cmake_parser/test_warning b/test/data/test_lint_cmake/test_warning
similarity index 100%
copy from test/data/test_cmake_parser/test_warning
copy to test/data/test_lint_cmake/test_warning
diff --git a/test/data/test_lint_lintian/test_invalid b/test/data/test_lint_lintian/test_invalid
new file mode 100644
index 0000000..6aa2e3c
--- /dev/null
+++ b/test/data/test_lint_lintian/test_invalid
@@ -0,0 +1,31 @@
+ building package `cantor-dbg' in `../cantor-dbg_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb'.
+INFO: pkgstriptranslations version 121
+INFO: Disabling pkgstriptranslations for PPA build
+INFO: Disabling pkgmaintainermangler for PPA build
+INFO: Disabling pkgstripfiles for PPA build
+dpkg-deb: building package `cantor-backend-python' in `../cantor-backend-python_15.04.0+git20150428.0243+15.04-0ubuntu0_all.deb'.
+=== Start list-missing
+=== End list-missing
+dpkg-genchanges > ../.pkg-kde-lintian.changes
+dpkg-genchanges: including full source code in upload
+rm ../.pkg-kde-lintian.changes
+make[1]: Leaving directory '/build/buildd/cantor-15.04.0+git20150428.0243+15.04'
+# "binary" target is done
+-- SUCCESS making standard target 'binary'.
+ dpkg-genchanges -b -mUbuntu Build Daemon <buildd at lgw01-18.buildd> >../cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.changes
+dpkg-genchanges: binary-only upload (no source code included)
+ dpkg-source --after-build cantor-15.04.0+git20150428.0243+15.04
+dpkg-buildpackage: binary-only upload (no source included)
+******************************************************************************
+Build finished at 20150428-0254
+
+chroot-autobuild/build/buildd/cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb:
+ new debian package, version 2.0.
+ size 372596 bytes: control archive=3863 bytes.
+ 138 bytes, 5 lines conffiles
+ 2260 bytes, 30 lines control
+ 6062 bytes, 71 lines md5sums
+ 135 bytes, 7 lines * postinst #!/bin/sh
+ 132 bytes, 7 lines * postrm #!/bin/sh
+ 61 bytes, 1 lines shlibs
+ Package: cantor
\ No newline at end of file
diff --git a/test/data/test_lint_lintian/test_lint b/test/data/test_lint_lintian/test_lint
new file mode 100644
index 0000000..504f0ac
--- /dev/null
+++ b/test/data/test_lint_lintian/test_lint
@@ -0,0 +1,41 @@
+ building package `cantor-dbg' in `../cantor-dbg_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb'.
+INFO: pkgstriptranslations version 121
+INFO: Disabling pkgstriptranslations for PPA build
+INFO: Disabling pkgmaintainermangler for PPA build
+INFO: Disabling pkgstripfiles for PPA build
+dpkg-deb: building package `cantor-backend-python' in `../cantor-backend-python_15.04.0+git20150428.0243+15.04-0ubuntu0_all.deb'.
+=== Start list-missing
+=== End list-missing
+dpkg-genchanges > ../.pkg-kde-lintian.changes
+dpkg-genchanges: including full source code in upload
+=== Start lintian
+warning: the authors of lintian do not recommend running it with root privileges!
+W: cantor source: out-of-date-standards-version 3.9.5 (current is 3.9.6)
+W: cantor-backend-octave: package-has-long-file-name 73 (82) > 80
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop1
+E: foo
+I: bar
+N: 2 tags overridden (1 error, 1 warning)
+=== End lintian
+rm ../.pkg-kde-lintian.changes
+make[1]: Leaving directory '/build/buildd/cantor-15.04.0+git20150428.0243+15.04'
+# "binary" target is done
+-- SUCCESS making standard target 'binary'.
+ dpkg-genchanges -b -mUbuntu Build Daemon <buildd at lgw01-18.buildd> >../cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.changes
+dpkg-genchanges: binary-only upload (no source code included)
+ dpkg-source --after-build cantor-15.04.0+git20150428.0243+15.04
+dpkg-buildpackage: binary-only upload (no source included)
+******************************************************************************
+Build finished at 20150428-0254
+
+chroot-autobuild/build/buildd/cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb:
+ new debian package, version 2.0.
+ size 372596 bytes: control archive=3863 bytes.
+ 138 bytes, 5 lines conffiles
+ 2260 bytes, 30 lines control
+ 6062 bytes, 71 lines md5sums
+ 135 bytes, 7 lines * postinst #!/bin/sh
+ 132 bytes, 7 lines * postrm #!/bin/sh
+ 61 bytes, 1 lines shlibs
+ Package: cantor
\ No newline at end of file
diff --git a/test/data/test_lint_list_missing/test_invalid b/test/data/test_lint_list_missing/test_invalid
new file mode 100644
index 0000000..6aa2e3c
--- /dev/null
+++ b/test/data/test_lint_list_missing/test_invalid
@@ -0,0 +1,31 @@
+ building package `cantor-dbg' in `../cantor-dbg_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb'.
+INFO: pkgstriptranslations version 121
+INFO: Disabling pkgstriptranslations for PPA build
+INFO: Disabling pkgmaintainermangler for PPA build
+INFO: Disabling pkgstripfiles for PPA build
+dpkg-deb: building package `cantor-backend-python' in `../cantor-backend-python_15.04.0+git20150428.0243+15.04-0ubuntu0_all.deb'.
+=== Start list-missing
+=== End list-missing
+dpkg-genchanges > ../.pkg-kde-lintian.changes
+dpkg-genchanges: including full source code in upload
+rm ../.pkg-kde-lintian.changes
+make[1]: Leaving directory '/build/buildd/cantor-15.04.0+git20150428.0243+15.04'
+# "binary" target is done
+-- SUCCESS making standard target 'binary'.
+ dpkg-genchanges -b -mUbuntu Build Daemon <buildd at lgw01-18.buildd> >../cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.changes
+dpkg-genchanges: binary-only upload (no source code included)
+ dpkg-source --after-build cantor-15.04.0+git20150428.0243+15.04
+dpkg-buildpackage: binary-only upload (no source included)
+******************************************************************************
+Build finished at 20150428-0254
+
+chroot-autobuild/build/buildd/cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb:
+ new debian package, version 2.0.
+ size 372596 bytes: control archive=3863 bytes.
+ 138 bytes, 5 lines conffiles
+ 2260 bytes, 30 lines control
+ 6062 bytes, 71 lines md5sums
+ 135 bytes, 7 lines * postinst #!/bin/sh
+ 132 bytes, 7 lines * postrm #!/bin/sh
+ 61 bytes, 1 lines shlibs
+ Package: cantor
\ No newline at end of file
diff --git a/test/data/test_lint_list_missing/test_lint b/test/data/test_lint_list_missing/test_lint
new file mode 100644
index 0000000..d1d66ed
--- /dev/null
+++ b/test/data/test_lint_list_missing/test_lint
@@ -0,0 +1,43 @@
+ building package `cantor-dbg' in `../cantor-dbg_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb'.
+INFO: pkgstriptranslations version 121
+INFO: Disabling pkgstriptranslations for PPA build
+INFO: Disabling pkgmaintainermangler for PPA build
+INFO: Disabling pkgstripfiles for PPA build
+dpkg-deb: building package `cantor-backend-python' in `../cantor-backend-python_15.04.0+git20150428.0243+15.04-0ubuntu0_all.deb'.
+=== Start list-missing
+-./etc
+-./usr/lib
+=== End list-missing
+dpkg-genchanges > ../.pkg-kde-lintian.changes
+dpkg-genchanges: including full source code in upload
+=== Start lintian
+warning: the authors of lintian do not recommend running it with root privileges!
+W: cantor source: out-of-date-standards-version 3.9.5 (current is 3.9.6)
+W: cantor-backend-octave: package-has-long-file-name 73 (82) > 80
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop1
+E: foo
+I: bar
+N: 2 tags overridden (1 error, 1 warning)
+=== End lintian
+rm ../.pkg-kde-lintian.changes
+make[1]: Leaving directory '/build/buildd/cantor-15.04.0+git20150428.0243+15.04'
+# "binary" target is done
+-- SUCCESS making standard target 'binary'.
+ dpkg-genchanges -b -mUbuntu Build Daemon <buildd at lgw01-18.buildd> >../cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.changes
+dpkg-genchanges: binary-only upload (no source code included)
+ dpkg-source --after-build cantor-15.04.0+git20150428.0243+15.04
+dpkg-buildpackage: binary-only upload (no source included)
+******************************************************************************
+Build finished at 20150428-0254
+
+chroot-autobuild/build/buildd/cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb:
+ new debian package, version 2.0.
+ size 372596 bytes: control archive=3863 bytes.
+ 138 bytes, 5 lines conffiles
+ 2260 bytes, 30 lines control
+ 6062 bytes, 71 lines md5sums
+ 135 bytes, 7 lines * postinst #!/bin/sh
+ 132 bytes, 7 lines * postrm #!/bin/sh
+ 61 bytes, 1 lines shlibs
+ Package: cantor
\ No newline at end of file
diff --git a/test/data/test_cmake_parser/test_missing_package b/test/data/test_lint_log/test_lint
similarity index 57%
copy from test/data/test_cmake_parser/test_missing_package
copy to test/data/test_lint_log/test_lint
index 5dbd970..825bc41 100644
--- a/test/data/test_cmake_parser/test_missing_package
+++ b/test/data/test_lint_log/test_lint
@@ -72,4 +72,47 @@ touch debian/dhmk_configure
/usr/bin/make -f debian/rules dhmk_run_build_commands DHMK_TARGET="build"
make[1]: Entering directory '/build/buildd/kanagram-14.12.2+git20150228.0146+15.04'
dh_testdir
-dh_auto_build '--buildsystem=kf5' --parallel
\ No newline at end of file
+dh_auto_build '--buildsystem=kf5' --parallel
+ building package `cantor-dbg' in `../cantor-dbg_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb'.
+INFO: pkgstriptranslations version 121
+INFO: Disabling pkgstriptranslations for PPA build
+INFO: Disabling pkgmaintainermangler for PPA build
+INFO: Disabling pkgstripfiles for PPA build
+dpkg-deb: building package `cantor-backend-python' in `../cantor-backend-python_15.04.0+git20150428.0243+15.04-0ubuntu0_all.deb'.
+=== Start list-missing
+-./etc
+-./usr/lib
+=== End list-missing
+dpkg-genchanges > ../.pkg-kde-lintian.changes
+dpkg-genchanges: including full source code in upload
+=== Start lintian
+warning: the authors of lintian do not recommend running it with root privileges!
+W: cantor source: out-of-date-standards-version 3.9.5 (current is 3.9.6)
+W: cantor-backend-octave: package-has-long-file-name 73 (82) > 80
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop
+W: cantor: desktop-mime-but-no-exec-code usr/share/applications/org.kde.cantor.desktop1
+E: foo
+I: bar
+N: 2 tags overridden (1 error, 1 warning)
+=== End lintian
+rm ../.pkg-kde-lintian.changes
+make[1]: Leaving directory '/build/buildd/cantor-15.04.0+git20150428.0243+15.04'
+# "binary" target is done
+-- SUCCESS making standard target 'binary'.
+ dpkg-genchanges -b -mUbuntu Build Daemon <buildd at lgw01-18.buildd> >../cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.changes
+dpkg-genchanges: binary-only upload (no source code included)
+ dpkg-source --after-build cantor-15.04.0+git20150428.0243+15.04
+dpkg-buildpackage: binary-only upload (no source included)
+******************************************************************************
+Build finished at 20150428-0254
+
+chroot-autobuild/build/buildd/cantor_15.04.0+git20150428.0243+15.04-0ubuntu0_amd64.deb:
+ new debian package, version 2.0.
+ size 372596 bytes: control archive=3863 bytes.
+ 138 bytes, 5 lines conffiles
+ 2260 bytes, 30 lines control
+ 6062 bytes, 71 lines md5sums
+ 135 bytes, 7 lines * postinst #!/bin/sh
+ 132 bytes, 7 lines * postrm #!/bin/sh
+ 61 bytes, 1 lines shlibs
+ Package: cantor
\ No newline at end of file
diff --git a/test/test_lint_cmake.rb b/test/test_lint_cmake.rb
new file mode 100644
index 0000000..b429c41
--- /dev/null
+++ b/test/test_lint_cmake.rb
@@ -0,0 +1,43 @@
+require_relative '../lib/lint/log/cmake'
+require_relative 'lib/testcase'
+
+# Test lint cmake
+class LintCMakeTest < TestCase
+ def data
+ path = super
+ File.read(path)
+ end
+
+ def test_init
+ r = Lint::Log::CMake.new.lint(data)
+ assert(!r.valid)
+ assert(r.informations.empty?)
+ assert(r.warnings.empty?)
+ assert(r.errors.empty?)
+ end
+
+ def test_missing_package
+ r = Lint::Log::CMake.new.lint(data)
+ assert(r.valid)
+ assert_equal(%w(KF5Package), r.warnings)
+ end
+
+ def test_optional
+ r = Lint::Log::CMake.new.lint(data)
+ assert(r.valid)
+ assert_equal(%w(Qt5TextToSpeech), r.warnings)
+ end
+
+ def test_warning
+ r = Lint::Log::CMake.new.lint(data)
+ assert(r.valid)
+ assert_equal(%w(), r.warnings)
+ end
+
+ def test_disabled_feature
+ r = Lint::Log::CMake.new.lint(data)
+ assert(r.valid)
+ assert_equal(['XCB-CURSOR , Required for XCursor support'],
+ r.warnings)
+ end
+end
diff --git a/test/test_lint_lintian.rb b/test/test_lint_lintian.rb
new file mode 100644
index 0000000..005340b
--- /dev/null
+++ b/test/test_lint_lintian.rb
@@ -0,0 +1,18 @@
+require_relative '../lib/lint/log/lintian'
+require_relative 'lib/testcase'
+
+# Test lint lintian
+class LintLintianTest < TestCase
+ def test_lint
+ r = Lint::Log::Lintian.new.lint(File.read(data))
+ assert(r.valid)
+ assert_equal(2, r.informations.size)
+ assert_equal(2, r.warnings.size)
+ assert_equal(1, r.errors.size)
+ end
+
+ def test_invalid
+ r = Lint::Log::Lintian.new.lint(File.read(data))
+ assert(!r.valid)
+ end
+end
diff --git a/test/test_lint_list_missing.rb b/test/test_lint_list_missing.rb
new file mode 100644
index 0000000..00d83f9
--- /dev/null
+++ b/test/test_lint_list_missing.rb
@@ -0,0 +1,18 @@
+require_relative '../lib/lint/log/list_missing'
+require_relative 'lib/testcase'
+
+# Test lint lintian
+class LintListMissingTest < TestCase
+ def test_lint
+ r = Lint::Log::ListMissing.new.lint(File.read(data))
+ assert(r.valid)
+ assert_equal(0, r.informations.size)
+ assert_equal(0, r.warnings.size)
+ assert_equal(2, r.errors.size)
+ end
+
+ def test_invalid
+ r = Lint::Log::ListMissing.new.lint('')
+ assert(!r.valid)
+ end
+end
diff --git a/test/test_lint_log.rb b/test/test_lint_log.rb
new file mode 100644
index 0000000..0568fb1
--- /dev/null
+++ b/test/test_lint_log.rb
@@ -0,0 +1,36 @@
+require_relative '../lib/lint/log'
+require_relative 'lib/testcase'
+
+# Test lint lintian
+class LintLogTest < TestCase
+ def data
+ File.read(super)
+ end
+
+ def test_lint
+ rs = Lint::Log.new(data).lint
+ infos = 0
+ warnings = 0
+ errors = 0
+ rs.each do |r|
+ assert(r.valid)
+ infos += r.informations.size
+ warnings += r.warnings.size
+ errors += r.errors.size
+ p r
+ end
+ # one I and one N from lintian
+ assert_equal(2, infos)
+ # two W from lintian, one cmake package
+ assert_equal(3, warnings)
+ # one E from lintian, two uninstalled files
+ assert_equal(3, errors)
+ end
+
+ def test_invalid
+ rs = Lint::Log.new('').lint
+ rs.each do |r|
+ assert(!r.valid)
+ end
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list