From 109c8733a13495d2ef961257feff913a2e9ae3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 2 Jun 2017 15:01:16 +0200 Subject: [PATCH 1/5] Use Docker at Travis also in the SLE12-SP2 branch --- .travis.yml | 27 ++++++++++----------------- Dockerfile | 4 ++++ 2 files changed, 14 insertions(+), 17 deletions(-) create mode 100644 Dockerfile diff --git a/.travis.yml b/.travis.yml index b08dc3fb0..fc27a4062 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,12 @@ -language: cpp -compiler: - - gcc +sudo: required +language: bash +services: + - docker + before_install: - # disable rvm, use system Ruby - - rvm reset - - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "rake yast2-core yast2-devtools yast2-testsuite yast2-ruby-bindings yast2-pkg-bindings ruby2.1-dev libaugeas-dev pkg-config gettext" -g "rspec:3.3.0 yast-rake gettext coveralls rubocop:0.41.2 cheetah abstract_method cfa" -script: - - rake check:pot - - rubocop - - make -s -f Makefile.cvs - - make -s - - sudo make -s install - # English messages, UTF-8, "C" locale for numeric formatting tests - - LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C make -s check - # English messages, UTF-8, "C" locale for numeric formatting tests, enable test coverage report - - LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C COVERAGE=1 rake test:unit + - docker build -t yast-yast2-image . +script: + # the "yast-travis-ruby" script is included in the base yastdevel/ruby image + # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby + - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-yast2-image yast-travis-ruby diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..65543d756 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM yastdevel/ruby:sle12-sp2 +COPY . /usr/src/app +# English messages, UTF-8, "C" locale for numeric formatting tests +ENV LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C From d826ffbcb04fd27572654122598b3661b4d9ad24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 2 Jun 2017 15:26:57 +0200 Subject: [PATCH 2/5] Update .gitignore --- .gitignore | 4 ++++ .travis.yml | 3 +-- Dockerfile | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8839019d0..25a8ab982 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +*.pot +*.log +*.trs Makefile /Makefile.am Makefile.am.common @@ -12,6 +15,7 @@ config.* configure configure.in configure.ac +coverage/ install-sh pluglib-bindings.ami */.dep diff --git a/.travis.yml b/.travis.yml index fc27a4062..c94b92b3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ sudo: required -language: bash +language: ruby services: - docker before_install: - docker build -t yast-yast2-image . - script: # the "yast-travis-ruby" script is included in the base yastdevel/ruby image # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby diff --git a/Dockerfile b/Dockerfile index 65543d756..cfd7a6d6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM yastdevel/ruby:sle12-sp2 +FROM yastdevel/ruby COPY . /usr/src/app # English messages, UTF-8, "C" locale for numeric formatting tests ENV LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C + From 7b20f08b1a71f1981ce61cef8f04a13904de0782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 2 Jun 2017 15:50:48 +0200 Subject: [PATCH 3/5] Testsuite update - mock Pkg calls --- .../test/file_conflict_callbacks_test.rb | 109 +++++++++++++++++- 1 file changed, 105 insertions(+), 4 deletions(-) diff --git a/library/packages/test/file_conflict_callbacks_test.rb b/library/packages/test/file_conflict_callbacks_test.rb index ce34e5714..0750d8897 100755 --- a/library/packages/test/file_conflict_callbacks_test.rb +++ b/library/packages/test/file_conflict_callbacks_test.rb @@ -24,6 +24,94 @@ def CallbackFileConflictReport(func) def CallbackFileConflictFinish(func) @fc_finish = func end + + # run this command in "irb -ryast" to obtain the method names: + # Yast.import "Pkg"; Yast::Pkg.methods.select {|m| m.to_s.start_with?("Callback")} + # (Remove the methods which are defined above.) + MOCK_METHODS = [ + :CallbackAcceptFileWithoutChecksum, + :CallbackAcceptUnknownDigest, + :CallbackAcceptUnknownGpgKey, + :CallbackAcceptUnsignedFile, + :CallbackAcceptVerificationFailed, + :CallbackAcceptWrongDigest, + :CallbackAuthentication, + :CallbackDestDownload, + :CallbackDoneDownload, + :CallbackDonePackage, + :CallbackDoneProvide, + :CallbackDoneRefresh, + :CallbackDoneScanDb, + :CallbackErrorScanDb, + :CallbackFinishDeltaApply, + :CallbackFinishDeltaDownload, + :CallbackImportGpgKey, + :CallbackInitDownload, + :CallbackMediaChange, + :CallbackMessage, + :CallbackNotifyConvertDb, + :CallbackNotifyRebuildDb, + :CallbackPkgGpgCheck, + :CallbackProblemDeltaApply, + :CallbackProblemDeltaDownload, + :CallbackProcessDone, + :CallbackProcessNextStage, + :CallbackProcessProgress, + :CallbackProcessStart, + :CallbackProgressConvertDb, + :CallbackProgressDeltaApply, + :CallbackProgressDeltaDownload, + :CallbackProgressDownload, + :CallbackProgressPackage, + :CallbackProgressProvide, + :CallbackProgressRebuildDb, + :CallbackProgressReportEnd, + :CallbackProgressReportProgress, + :CallbackProgressReportStart, + :CallbackProgressScanDb, + :CallbackResolvableReport, + :CallbackScriptFinish, + :CallbackScriptProblem, + :CallbackScriptProgress, + :CallbackScriptStart, + :CallbackSourceChange, + :CallbackSourceCreateDestroy, + :CallbackSourceCreateEnd, + :CallbackSourceCreateError, + :CallbackSourceCreateInit, + :CallbackSourceCreateProgress, + :CallbackSourceCreateStart, + :CallbackSourceProbeEnd, + :CallbackSourceProbeError, + :CallbackSourceProbeFailed, + :CallbackSourceProbeProgress, + :CallbackSourceProbeStart, + :CallbackSourceProbeSucceeded, + :CallbackSourceReportDestroy, + :CallbackSourceReportEnd, + :CallbackSourceReportError, + :CallbackSourceReportInit, + :CallbackSourceReportProgress, + :CallbackSourceReportStart, + :CallbackStartConvertDb, + :CallbackStartDeltaApply, + :CallbackStartDeltaDownload, + :CallbackStartDownload, + :CallbackStartPackage, + :CallbackStartProvide, + :CallbackStartRebuildDb, + :CallbackStartRefresh, + :CallbackStartScanDb, + :CallbackStopConvertDb, + :CallbackStopRebuildDb, + :CallbackTrustedKeyAdded, + :CallbackTrustedKeyRemoved + ].freeze + + MOCK_METHODS.each do |method| + # mock empty methods with a single argument + define_method(method) { |arg| } + end end describe Packages::FileConflictCallbacks do @@ -42,10 +130,10 @@ def CallbackFileConflictFinish(func) describe ".register" do it "calls the Pkg methods for registering the file conflicts handlers" do - expect(dummy_pkg).to receive(:CallbackFileConflictStart) - expect(dummy_pkg).to receive(:CallbackFileConflictProgress) - expect(dummy_pkg).to receive(:CallbackFileConflictReport) - expect(dummy_pkg).to receive(:CallbackFileConflictFinish) + expect(dummy_pkg).to receive(:CallbackFileConflictStart).at_least(:once) + expect(dummy_pkg).to receive(:CallbackFileConflictProgress).at_least(:once) + expect(dummy_pkg).to receive(:CallbackFileConflictReport).at_least(:once) + expect(dummy_pkg).to receive(:CallbackFileConflictFinish).at_least(:once) Packages::FileConflictCallbacks.register end @@ -71,6 +159,10 @@ def CallbackFileConflictFinish(func) end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "reuses the package installation progress" do expect(Yast::UI).to receive(:WidgetExists).and_return(true) expect(Yast::UI).to receive(:ChangeWidget).twice @@ -121,6 +213,10 @@ def CallbackFileConflictFinish(func) end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "returns false to abort if user clicks Abort" do expect(Yast::UI).to receive(:PollInput).and_return(:abort) @@ -232,6 +328,7 @@ def CallbackFileConflictFinish(func) context "in UI mode" do before do + allow(Yast::Mode).to receive(:commandline).and_return(false) allow(Yast::UI).to receive(:OpenDialog) allow(Yast::UI).to receive(:CloseDialog) allow(Yast::UI).to receive(:SetFocus) @@ -280,6 +377,10 @@ def CallbackFileConflictFinish(func) end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "no change if installation progress was already displayed" do ui = double("no method call expected", WidgetExists: true) stub_const("Yast::UI", ui) From 3e81cb92c1fe4e9f767245f545fa02376542d1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 2 Jun 2017 17:34:34 +0200 Subject: [PATCH 4/5] Added debugging command --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index c94b92b3c..8a75ba453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ services: before_install: - docker build -t yast-yast2-image . + # list the installed packages (just for easier debugging) + - docker run --rm -it yast-yast2-image rpm -qa | sort + script: # the "yast-travis-ruby" script is included in the base yastdevel/ruby image # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby From 23df941bcafdaac722854c5d78df2bab1fcdf2cd Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Mon, 7 Aug 2017 11:03:32 +0200 Subject: [PATCH 5/5] Revert "fix Rakefile" This reverts commit b03c6ad007d902aabc878531affbb8d23060c200. --- Rakefile | 2 +- package/yast2.spec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index acaec0f7c..5b4852746 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ require "yast/rake" -Yast::Tasks.submit_to :casp10 +Yast::Tasks.submit_to :sle12sp2 Yast::Tasks.configuration do |conf| # lets ignore license check for now diff --git a/package/yast2.spec b/package/yast2.spec index 2c5e72093..47519ff1d 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -37,8 +37,8 @@ BuildRequires: rubygem(%{rb_default_ruby_abi}:cfa) # for running scripts BuildRequires: rubygem(%{rb_default_ruby_abi}:cheetah) # For running RSpec tests during build -BuildRequires: update-desktop-files BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) +BuildRequires: update-desktop-files # Needed already in build time BuildRequires: yast2-core >= 2.18.12 BuildRequires: yast2-devtools >= 3.1.10 @@ -62,8 +62,8 @@ Requires: rubygem(%{rb_default_ruby_abi}:abstract_method) # for file access using augeas Requires: rubygem(%{rb_default_ruby_abi}:cfa) # for running scripts -Requires: sysconfig >= 0.80.0 Requires: rubygem(%{rb_default_ruby_abi}:cheetah) +Requires: sysconfig >= 0.80.0 # ag_ini section_private # ag_ini with (un)quoting support Requires: yast2-core >= 2.23.0