commit yast2-tune for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-tune for openSUSE:Factory checked in at 2017-08-29 11:34:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-tune (Old) and /work/SRC/openSUSE:Factory/.yast2-tune.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-tune" Tue Aug 29 11:34:07 2017 rev:59 rq:516968 version:3.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-tune/yast2-tune.changes 2017-02-04 16:52:36.428590164 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-tune.new/yast2-tune.changes 2017-08-29 11:34:08.904167357 +0200 @@ -1,0 +2,7 @@ +Mon Aug 14 18:19:47 UTC 2017 - lslezak@suse.cz + +- Fixed scheduler activation: do not activate the new scheduler + for devices which do not support it (bsc#1052770) +- 3.3.0 + +------------------------------------------------------------------- Old: ---- yast2-tune-3.2.0.tar.bz2 New: ---- yast2-tune-3.3.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-tune.spec ++++++ --- /var/tmp/diff_new_pack.yAs0Q1/_old 2017-08-29 11:34:09.760047101 +0200 +++ /var/tmp/diff_new_pack.yAs0Q1/_new 2017-08-29 11:34:09.772045414 +0200 @@ -17,7 +17,7 @@ Name: yast2-tune -Version: 3.2.0 +Version: 3.3.0 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-tune-3.2.0.tar.bz2 -> yast2-tune-3.3.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/.travis.yml new/yast2-tune-3.3.0/.travis.yml --- old/yast2-tune-3.2.0/.travis.yml 2017-01-31 09:51:51.391173433 +0100 +++ new/yast2-tune-3.3.0/.travis.yml 2017-08-15 10:26:47.899310986 +0200 @@ -5,6 +5,9 @@ before_install: - docker build -t yast-tune-image . + # list the installed packages (just for easier debugging) + - docker run --rm -it yast-tune-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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/package/yast2-tune.changes new/yast2-tune-3.3.0/package/yast2-tune.changes --- old/yast2-tune-3.2.0/package/yast2-tune.changes 2017-01-31 09:51:51.423173433 +0100 +++ new/yast2-tune-3.3.0/package/yast2-tune.changes 2017-08-15 10:26:47.903310986 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Aug 14 18:19:47 UTC 2017 - lslezak@suse.cz + +- Fixed scheduler activation: do not activate the new scheduler + for devices which do not support it (bsc#1052770) +- 3.3.0 + +------------------------------------------------------------------- Fri Jan 20 16:21:30 UTC 2017 - mvidner@suse.com - Added Tune::Widgets::SystemInformation (FATE#322328). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/package/yast2-tune.spec new/yast2-tune-3.3.0/package/yast2-tune.spec --- old/yast2-tune-3.2.0/package/yast2-tune.spec 2017-01-31 09:51:51.423173433 +0100 +++ new/yast2-tune-3.3.0/package/yast2-tune.spec 2017-08-15 10:26:47.903310986 +0200 @@ -17,7 +17,7 @@ Name: yast2-tune -Version: 3.2.0 +Version: 3.3.0 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/src/modules/SystemSettings.rb new/yast2-tune-3.3.0/src/modules/SystemSettings.rb --- old/yast2-tune-3.2.0/src/modules/SystemSettings.rb 2017-01-31 09:51:51.463173433 +0100 +++ new/yast2-tune-3.3.0/src/modules/SystemSettings.rb 2017-08-15 10:26:47.907310986 +0200 @@ -248,11 +248,38 @@ # activate the scheduler for all disk devices return if new_elevator == :missing Dir["/sys/block/*/queue/scheduler"].each do |f| + # skip devices which do not support the selected scheduler, + # keep the original scheduler + next unless device_supports_scheduler(f, new_elevator) + log.info("Activating scheduler '#{new_elevator}' for device #{f}") File.write(f, new_elevator) end end + # read available schedulers for the device + # @param device [String] path to device scheduler file + # @return [Array<String>] read schedulers from the file + def read_device_schedulers(device) + schedulers = File.read(device).split(/\s+/).map do |sched| + # remove the current scheduler marks [] around the name + sched[0] == "[" && sched [-1] == "]" ? sched[1..-2] : sched + end + + log.info("Available schedulers for #{device}: #{schedulers}") + + schedulers + end + + # does the device support support the scheduler? + # @param device [String] path to device scheduler file + # @param scheduler [String] name of the requested scheduler + # @return [Boolean] true if supported + def device_supports_scheduler(device, scheduler) + schedulers = read_device_schedulers(device) + schedulers.include?(scheduler) + end + # Read IO scheduler configuration updating the module's value # # @see Read diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/test/system_settings_test.rb new/yast2-tune-3.3.0/test/system_settings_test.rb --- old/yast2-tune-3.2.0/test/system_settings_test.rb 2017-01-31 09:51:51.463173433 +0100 +++ new/yast2-tune-3.3.0/test/system_settings_test.rb 2017-08-15 10:26:47.907310986 +0200 @@ -9,10 +9,13 @@ KERNEL_SYSRQ_FILE = "/proc/sys/kernel/sysrq" subject(:settings) { Yast::SystemSettings } + let(:scheduler) { "cfq" } before do allow(File).to receive(:exist?).and_return(true) allow(Yast::Bootloader).to receive(:Read) + allow(Yast::Bootloader).to receive(:kernel_param) + .with(:common, "elevator").and_return(scheduler) settings.main end @@ -25,7 +28,6 @@ describe "#Read" do let(:kernel_sysrq) { "1" } let(:sysctl_sysrq) { "1" } - let(:scheduler) { "cfq" } before do allow(Yast::SCR).to receive(:Read) @@ -121,13 +123,14 @@ let(:sysrq_keys) { false } let(:scheduler) { "" } let(:disk) { "/sys/block/sda/queue/scheduler" } + let(:disk2) { "/sys/block/sdb/queue/scheduler" } before do settings.SetSysRqKeysEnabled(sysrq_keys) settings.SetIOScheduler(scheduler) allow(Yast::Bootloader).to receive(:modify_kernel_params) allow(Yast::Bootloader).to receive(:proposed_cfg_changed=) - allow(Dir).to receive(:[]).with(/scheduler/).and_return([disk]) + allow(Dir).to receive(:[]).with(/scheduler/).and_return([disk, disk2]) end context "when SysRq keys status is unknown" do @@ -159,6 +162,8 @@ before do allow(File).to receive(:write).with(KERNEL_SYSRQ_FILE, anything) + allow(File).to receive(:read).with(disk).and_return("noop deadline [cfq]") + allow(File).to receive(:read).with(disk2).and_return("noop deadline [cfq]") end it "updates bootloader configuration" do @@ -171,6 +176,16 @@ it "activates scheduler for all disk devices" do expect(File).to receive(:write).with(disk, scheduler) + expect(File).to receive(:write).with(disk2, scheduler) + settings.Activate + end + + it "does not activate the scheduler if the device does not support it" do + # make the "cfq" scheduler unsupported + expect(File).to receive(:read).with(disk2).and_return("[mq-deadline] none") + expect(File).to receive(:write).with(disk, scheduler) + # ensure it is not changed + expect(File).to_not receive(:write).with(disk2, scheduler) settings.Activate end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-3.2.0/test/test_helper.rb new/yast2-tune-3.3.0/test/test_helper.rb --- old/yast2-tune-3.2.0/test/test_helper.rb 2017-01-31 09:51:51.483173433 +0100 +++ new/yast2-tune-3.3.0/test/test_helper.rb 2017-08-15 10:26:47.907310986 +0200 @@ -8,9 +8,9 @@ add_filter "/spec/" end - # for coverage we need to load all ruby files src_location = File.expand_path("../../src", __FILE__) - Dir["#{src_location}/{modules,lib}/**/*.rb"].each { |f| require_relative f } + # track all ruby files under src + SimpleCov.track_files("#{src_location}/**/*.rb") # use coveralls for on-line code coverage reporting at Travis CI if ENV["TRAVIS"]
participants (1)
-
root@hilbert.suse.de