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 2020-12-21 12:34:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-tune (Old) and /work/SRC/openSUSE:Factory/.yast2-tune.new.5145 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-tune" Mon Dec 21 12:34:47 2020 rev:68 rq:856741 version:4.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-tune/yast2-tune.changes 2020-04-11 23:45:26.807039539 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-tune.new.5145/yast2-tune.changes 2020-12-21 12:34:48.666884021 +0100 @@ -1,0 +2,12 @@ +Thu Dec 17 16:04:32 UTC 2020 - Steffen Winterfeldt <snwint@suse.com> + +- remove elevator settings (bsc#1178797) +- 4.3.1 + +------------------------------------------------------------------- +Thu Dec 17 15:13:33 UTC 2020 - Steffen Winterfeldt <snwint@suse.com> + +- add I/O device autoconfig checkbox on s390 (bsc#1168036) +- 4.3.0 + +------------------------------------------------------------------- Old: ---- yast2-tune-4.2.3.tar.bz2 New: ---- yast2-tune-4.3.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-tune.spec ++++++ --- /var/tmp/diff_new_pack.ujuyRa/_old 2020-12-21 12:34:49.214884471 +0100 +++ /var/tmp/diff_new_pack.ujuyRa/_new 2020-12-21 12:34:49.218884474 +0100 @@ -1,7 +1,7 @@ # # spec file for package yast2-tune # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,17 +12,17 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: yast2-tune -Version: 4.2.3 +Version: 4.3.1 Release: 0 Summary: YaST2 - Hardware Tuning License: GPL-2.0-or-later Group: System/YaST -Url: https://github.com/yast/yast-tune +URL: https://github.com/yast/yast-tune Source0: %{name}-%{version}.tar.bz2 ++++++ yast2-tune-4.2.3.tar.bz2 -> yast2-tune-4.3.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/.github/workflows/ci.yml new/yast2-tune-4.3.1/.github/workflows/ci.yml --- old/yast2-tune-4.2.3/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-tune-4.3.1/.github/workflows/ci.yml 2020-12-17 18:50:19.000000000 +0100 @@ -0,0 +1,83 @@ + +# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-acti... + +name: CI + +on: [push, pull_request] + +jobs: + Tests: + runs-on: ubuntu-latest + container: registry.opensuse.org/yast/head/containers/yast-ruby:latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v2 + + # just for easier debugging... + - name: Inspect Installed Packages + run: rpm -qa | sort + + - name: Unit Tests + run: rake test:unit + # enable code coverage reporting + env: + COVERAGE: 1 + + # send the coverage report to coveralls.io + - name: Coveralls Report + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # FIXME: Rubocop is not used here + # Rubocop: + # runs-on: ubuntu-latest + # container: registry.opensuse.org/yast/head/containers/yast-ruby:latest + + # steps: + + # - name: Git Checkout + # uses: actions/checkout@v2 + + # - name: Rubocop + # run: rake check:rubocop + + Package: + runs-on: ubuntu-latest + container: registry.opensuse.org/yast/head/containers/yast-ruby:latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Package Build + run: yast-ci-ruby -o package + + Yardoc: + runs-on: ubuntu-latest + container: registry.opensuse.org/yast/head/containers/yast-ruby:latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Yardoc + run: rake check:doc + + # downloading the Docker image takes some time so bundling several fast + # checks into one job avoids that overhead + Checks: + runs-on: ubuntu-latest + container: registry.opensuse.org/yast/head/containers/yast-ruby:latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v2 + + - name: POT Check + run: rake check:pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/.travis.yml new/yast2-tune-4.3.1/.travis.yml --- old/yast2-tune-4.2.3/.travis.yml 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -sudo: required -language: bash -services: - - docker - -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 - - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-tune-image yast-travis-ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/Dockerfile new/yast2-tune-4.3.1/Dockerfile --- old/yast2-tune-4.2.3/Dockerfile 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/Dockerfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -FROM registry.opensuse.org/yast/head/containers/yast-ruby:latest -COPY . /usr/src/app - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/README.md new/yast2-tune-4.3.1/README.md --- old/yast2-tune-4.2.3/README.md 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/README.md 2020-12-17 18:50:19.000000000 +0100 @@ -1,5 +1,6 @@ # YaST - The Tune Module # -[![Travis Build](https://travis-ci.org/yast/yast-tune.svg?branch=master)](https://travis-ci.org/yast/yast-tune) -[![Jenkins Build](http://img.shields.io/jenkins/s/https/ci.opensuse.org/yast-tune-master.svg)](https://ci.opensuse.org/view/Yast/job/yast-tune-master/) - +[![Workflow Status](https://github.com/yast/yast-tune/workflows/CI/badge.svg?branch=master)]( +https://github.com/yast/yast-tune/actions?query=branch%3Amaster) +[![Jenkins Status](https://ci.opensuse.org/buildStatus/icon?job=yast-yast-tune-master)]( +https://ci.opensuse.org/view/Yast/job/yast-yast-tune-master/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/package/yast2-tune.changes new/yast2-tune-4.3.1/package/yast2-tune.changes --- old/yast2-tune-4.2.3/package/yast2-tune.changes 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/package/yast2-tune.changes 2020-12-17 18:50:19.000000000 +0100 @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Thu Dec 17 16:04:32 UTC 2020 - Steffen Winterfeldt <snwint@suse.com> + +- remove elevator settings (bsc#1178797) +- 4.3.1 + +------------------------------------------------------------------- +Thu Dec 17 15:13:33 UTC 2020 - Steffen Winterfeldt <snwint@suse.com> + +- add I/O device autoconfig checkbox on s390 (bsc#1168036) +- 4.3.0 + +------------------------------------------------------------------- Mon Feb 24 15:10:14 CET 2020 - schubi@suse.de - Using SysctlConfig class: Handle sysctl entries in different diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/package/yast2-tune.spec new/yast2-tune-4.3.1/package/yast2-tune.spec --- old/yast2-tune-4.2.3/package/yast2-tune.spec 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/package/yast2-tune.spec 2020-12-17 18:50:19.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-tune -Version: 4.2.3 +Version: 4.3.1 Release: 0 Summary: YaST2 - Hardware Tuning License: GPL-2.0-or-later diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/src/include/hwinfo/system_settings_dialogs.rb new/yast2-tune-4.3.1/src/include/hwinfo/system_settings_dialogs.rb --- old/yast2-tune-4.2.3/src/include/hwinfo/system_settings_dialogs.rb 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/src/include/hwinfo/system_settings_dialogs.rb 2020-12-17 18:50:19.000000000 +0100 @@ -31,6 +31,17 @@ @contents = VBox("tab") + # whether to show I/O device autoconfig checkbox + has_autoconf = Arch.s390 + + kernel_widget_names = ["sysrq"] + kernel_widgets = [VSpacing(1), Left("sysrq")] + + if has_autoconf + kernel_widget_names << "autoconf" + kernel_widgets << VSpacing(1) << Left("autoconf") + end + @tabs_descr = { "pci_id" => { "header" => NewPCIIDDialogCaption(), @@ -46,12 +57,12 @@ "contents" => VBox( HBox( HSpacing(1), - VBox(VSpacing(0.3), Left("elevator"), VSpacing(1), Left("sysrq")), + VBox(*kernel_widgets), HSpacing(1) ), VStretch() ), - "widget_names" => ["elevator", "sysrq"] + "widget_names" => kernel_widget_names } } @@ -72,58 +83,6 @@ "symbol (string, map)" ) }, - # /usr/src/linux/Documentation/kernel-parameters.txt - # http://www.redhat.com/magazine/008jun05/features/schedulers/ - # - # elevator= [IOSCHED] - # Format: {"cfq"|"deadline"|"noop"} - # See Documentation/block/as-iosched.txt - # and Documentation/block/deadline-iosched.txt for details. - # - # 'deadline' => Deadline. Database servers, especially those using "TCQ" disks should - # investigate performance with the 'deadline' IO scheduler. Any system with high - # disk performance requirements should do so, in fact. - # 'noop' => NOOP - # 'cfq' => Completely Fair Queuing (the default) - "elevator" => { - "widget" => :custom, - # combo box label - "custom_widget" => ComboBox( - Id("elevator"), - _("Global &I/O Scheduler"), - [ - # combo box item - I/O scheduler - Item(Id(""), _("Not Configured")), - # combo box item - I/O scheduler, do not translate the abbreviation in brackets - Item(Id("cfq"), _("Completely Fair Queuing [cfq]")), - # combo box item - I/O scheduler, do not translate the abbreviation in brackets - Item(Id("noop"), _("NOOP [noop]")), - # combo box item - I/O scheduler, do not translate the abbreviation in brackets - Item(Id("deadline"), _("Deadline [deadline]")) - ] - ), - "handle" => fun_ref( - method(:HandleElevatorSettings), - "symbol (string, map)" - ), - "init" => fun_ref( - method(:InitElevatorSettings), - "void (string)" - ), - "store" => fun_ref( - method(:StoreElevatorSettings), - "void (string, map)" - ), - # help text for the scheduler widget, do not translate 'cfq' - "help" => _( - "<p><b><big>Global I/O Scheduler</big></b><br>\n" + - "Select the algorithm which orders and sends commands to disk\n" + - "devices. This is a global option, it will be used for all disk devices in the\n" + - "system. If the option is not configured, the default scheduler (usually 'cfq')\n" + - "will be used. See the documentation in the /usr/src/linux/Documentation/block\n" + - "directory (package kernel-source) for more information.</p>\n" - ) - }, # .sysconfig.sysctl "sysrq" => { "widget" => :checkbox, @@ -139,6 +98,17 @@ "computer, dump kernel information). For further information, see\n" + "<tt>/usr/src/linux/Documentation/sysrq.txt</tt> (package kernel-source).</p>\n" ) + }, + "autoconf" => { + "widget" => :checkbox, + "label" => _("Enable I/O device auto-configuration"), + "store" => fun_ref(method(:StoreAutoConfSettings), "void (string, map)"), + "init" => fun_ref(method(:InitAutoConfSettings), "void (string)"), + "help" => _( + "<p><b><big>Enable I/O device auto-configuration</big></b><br>\n" + + "Disable <b>I/O device auto-configuration</b>\n" + + "if you don't want any existing I/O auto-configuration data to be applied.</p>\n" + ) } } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/src/include/hwinfo/system_settings_ui.rb new/yast2-tune-4.3.1/src/include/hwinfo/system_settings_ui.rb --- old/yast2-tune-4.2.3/src/include/hwinfo/system_settings_ui.rb 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/src/include/hwinfo/system_settings_ui.rb 2020-12-17 18:50:19.000000000 +0100 @@ -119,44 +119,39 @@ :next end - - def HandleElevatorSettings(key, event) - event = deep_copy(event) - Builtins.y2milestone("Key: %1, Event: %2", key, event) - nil - end - - def InitElevatorSettings(value) + def InitSysRqSettings(key) Wizard.DisableBackButton - UI.ChangeWidget(Id("elevator"), :Value, SystemSettings.GetIOScheduler) + UI.ChangeWidget(Id("sysrq"), :Value, SystemSettings.GetSysRqKeysEnabled) nil end - def StoreElevatorSettings(key, event) + def StoreSysRqSettings(key, event) event = deep_copy(event) Builtins.y2milestone("Key: %1, Event: %2", key, event) - elevator_new = Convert.to_string(UI.QueryWidget(Id("elevator"), :Value)) - SystemSettings.SetIOScheduler(elevator_new) + sysrq_new = Convert.to_boolean(UI.QueryWidget(Id("sysrq"), :Value)) + if SystemSettings.GetSysRqKeysEnabled != sysrq_new + SystemSettings.SetSysRqKeysEnabled(sysrq_new) + end nil end - def InitSysRqSettings(key) + def InitAutoConfSettings(key) Wizard.DisableBackButton - UI.ChangeWidget(Id("sysrq"), :Value, SystemSettings.GetSysRqKeysEnabled) + UI.ChangeWidget(Id("autoconf"), :Value, SystemSettings.GetAutoConf) nil end - def StoreSysRqSettings(key, event) + def StoreAutoConfSettings(key, event) event = deep_copy(event) Builtins.y2milestone("Key: %1, Event: %2", key, event) - sysrq_new = Convert.to_boolean(UI.QueryWidget(Id("sysrq"), :Value)) - if SystemSettings.GetSysRqKeysEnabled != sysrq_new - SystemSettings.SetSysRqKeysEnabled(sysrq_new) + autoconf_new = Convert.to_boolean(UI.QueryWidget(Id("autoconf"), :Value)) + if SystemSettings.GetAutoConf != autoconf_new + SystemSettings.SetAutoConf(autoconf_new) end nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/src/modules/SystemSettings.rb new/yast2-tune-4.3.1/src/modules/SystemSettings.rb --- old/yast2-tune-4.2.3/src/modules/SystemSettings.rb 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/src/modules/SystemSettings.rb 2020-12-17 18:50:19.000000000 +0100 @@ -24,26 +24,14 @@ Yast.import "Mode" # Internal Data - @elevator = nil @enable_sysrq = nil @kernel_sysrq = nil @sysctl_config = nil @sysctl_sysrq = nil + @autoconf = true @modified = false end - # Known values of the 'elevator' variable - ELEVATORS = ["cfq", "noop", "deadline"].freeze - - # Return the possible values to be used as elevators/schedulers - # - # @return [Array<String>] Know elevators/schedulers - # - # @see ELEVATORS - def GetPossibleElevatorValues - ELEVATORS - end - # Determine if the module was modified def Modified log.info("Modified: #{@modified}") @@ -53,12 +41,11 @@ # Read system settings # # @see #read_sysrq - # @see #read_scheduler + # @see #read_autoconf def Read read_sysrq - ret = read_scheduler + read_autoconf - return false unless ret @modified = false true end @@ -66,44 +53,20 @@ # Activate settings # # @see #activate_sysrq - # @see #activate_scheduler + # @see #activate_autoconf def Activate activate_sysrq - activate_scheduler + activate_autoconf + true end # Write settings to system configuration def Write write_sysrq - write_scheduler - end - - # Return the kernel IO scheduler - # - # The scheduler is specified as the 'elevator' kernel parameter. - # If not scheduler is set, it will return an empty string. - # - # @return [String] IO scheduler name or empty string if not set - def GetIOScheduler - @elevator - end - - # Set IO scheduler - # - # @param scheduler [String] IO scheduler - def SetIOScheduler(scheduler) - # empty string = use the default scheduler - if valid_scheduler?(scheduler) || scheduler == "" - if GetIOScheduler() != scheduler - @modified = true - @elevator = scheduler - end - else - log.error("unknown IO scheduler '#{scheduler}', use: #{GetPossibleElevatorValues()}") - end + write_autoconf - nil + true end # Determine if SysRq keys are enabled @@ -131,15 +94,34 @@ nil end - publish function: :GetPossibleElevatorValues, type: "list <string> ()" + # Determine current I/O device autoconf setting + # + # @return [Boolean] true if enabled; false otherwise. + def GetAutoConf + log.info "GetAutoConf = #{@autoconf}" + @autoconf + end + + # Set I/O device autoconf status + # + # @param value [Boolean] true to enable; false to disable + def SetAutoConf(value) + if value != @autoconf + @modified = true + @autoconf = value + end + + nil + end + publish function: :Modified, type: "boolean ()" publish function: :Read, type: "boolean ()" publish function: :Activate, type: "boolean ()" publish function: :Write, type: "boolean ()" - publish function: :GetIOScheduler, type: "string ()" - publish function: :SetIOScheduler, type: "void (string)" publish function: :GetSysRqKeysEnabled, type: "boolean ()" publish function: :SetSysRqKeysEnabled, type: "void (boolean)" + publish function: :GetAutoConf, type: "boolean ()" + publish function: :SetAutoConf, type: "void (boolean)" protected @@ -190,39 +172,6 @@ @sysctl_sysrq end - # Determine if a string is a valid scheduler name - # - # @return [Boolean] true if it's valid; false otherwise. - def valid_scheduler?(elevator) - GetPossibleElevatorValues().include?(elevator) - end - - # Determine the current scheduler from the system - # - # @return [String] IO Scheduler name; if it's not valid/set, it will return an empty string - def current_elevator - # get 'elevator' option from the default section - elevator_parameter = Bootloader.kernel_param(:common, "elevator") - log.info("elevator_parameter: #{elevator_parameter}") - - if elevator_parameter == :missing # Variable is not set - "" - elsif elevator_parameter == :present # Variable is set but has not parameter - log.info("'elevator' variable has to have some value") - "" - elsif !valid_scheduler?(elevator_parameter.to_s) # Variable is set but hasn't any known value - log.warn( - format("'elevator' variable has to have a value from %s instead of being set to %s", - GetPossibleElevatorValues(), - elevator_parameter - ) - ) - "" - else - elevator_parameter.to_s - end - end - # Activate SysRq keys configuration # # @see enable_sysrq @@ -236,73 +185,15 @@ File.write(KERNEL_SYSRQ_FILE, "#{enable_sysrq}\n") end - # Activate IO scheduler - # - # @see activate_scheduler - def activate_scheduler - return unless GetIOScheduler() - - new_elevator = GetIOScheduler() == "" ? :missing : GetIOScheduler() - log.info("Activating scheduler: #{new_elevator}") - # set the scheduler - Bootloader.modify_kernel_params("elevator" => new_elevator) - # set bootloader configuration as 'changed' (bsc#968192) - Bootloader.proposed_cfg_changed = true - - # 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 - # - # @return [Boolean] false if there is a problem reading the bootloader; true otherwise - def read_scheduler - # Try to read the bootloader settings in normal mode. - # If there is a problem, the user will be warned directly by the bootloader module. - if Mode.normal - bootloader_read = Bootloader.Read - - return false unless bootloader_read + # Activate I/O device autoconf setting + def activate_autoconf + if @autoconf + log.info("removing rd.zdev kernel parameter") + Bootloader.modify_kernel_params("rd.zdev" => :missing) + else + log.info("adding rd.zdev=no-auto kernel parameter") + Bootloader.modify_kernel_params("rd.zdev" => "no-auto") end - - # Set IO scheduler - SetIOScheduler(current_elevator) - log.info("Global IO scheduler: #{GetIOScheduler()}") - - true end # Read SysRq keys configuration updating the module's value @@ -333,16 +224,23 @@ sysctl_config.save unless sysctl_config.conflict? end - # Write IO Scheduler settings + # Read I/O device autoconfig settings + def read_autoconf + rd_zdev = Bootloader.kernel_param(:common, "rd.zdev") + log.info "current rd.zdev setting: rd.zdev=#{rd_zdev.inspect}" + + @autoconf = rd_zdev != "no-auto" + end + + # Write I/O device autoconfig settings # # This method only has effect during normal mode. During installation, # bootloader configuration is written at the end of the first stage. # # @see Bootloader#Write # @see Write - def write_scheduler + def write_autoconf Bootloader.Write if Mode.normal - true end private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/test/system_settings_test.rb new/yast2-tune-4.3.1/test/system_settings_test.rb --- old/yast2-tune-4.2.3/test/system_settings_test.rb 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/test/system_settings_test.rb 2020-12-17 18:50:19.000000000 +0100 @@ -9,26 +9,20 @@ KERNEL_SYSRQ_FILE = "/proc/sys/kernel/sysrq" subject(:settings) { Yast::SystemSettings } - let(:scheduler) { "cfq" } + let(:rd_zdev) { "no-auto" } let(:sysctl_config) { CFA::SysctlConfig.new } 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) + .with(:common, "rd.zdev").and_return(rd_zdev) allow(CFA::SysctlConfig).to receive(:new).and_return(sysctl_config) allow(sysctl_config).to receive(:load) allow(sysctl_config).to receive(:save) settings.main end - describe "#GetPossibleElevatorValues" do - it "returns an array with possible schedulers" do - expect(settings.GetPossibleElevatorValues).to match_array(["cfq", "noop", "deadline"]) - end - end - describe "#Read" do let(:kernel_sysrq) { "1" } let(:sysctl_sysrq) { "1" } @@ -39,7 +33,7 @@ allow(File).to receive(:read).with(KERNEL_SYSRQ_FILE) .and_return(kernel_sysrq) allow(Yast::Bootloader).to receive(:kernel_param) - .with(:common, "elevator").and_return(scheduler) + .with(:common, "rd.zdev").and_return(rd_zdev) allow(Yast::Mode).to receive(:mode).and_return(mode) end @@ -71,93 +65,34 @@ end end - context "when is in normal mode" do - before do - allow(Yast::Bootloader).to receive(:Read).and_return(bootloader_read) - end - - context "and the bootloader can be read" do - let(:bootloader_read) { true } - - it "returns true" do - expect(settings.Read).to eq(true) - end - - context "when scheduler parameter is missing" do - let(:scheduler) { :missing } - - it "unsets IO scheduler" do - settings.Read - expect(settings.GetIOScheduler).to eq("") - end - end - - context "when scheduler parameter is present but does not have a value" do - let(:scheduler) { :present } - - it "unsets IO scheduler" do - settings.Read - expect(settings.GetIOScheduler).to eq("") - end - end - - context "when scheduler parameter has a valid value" do - it "sets IO scheduler to that value" do - settings.Read - expect(settings.GetIOScheduler).to eq(scheduler) - end - end + context "when rd.zdev kernel option is set" do + let(:rd_zdev) { "no-auto" } - context "when scheduler parameter has an invalid value" do - let(:scheduler) { "some-scheduler" } - - it "unsets IO scheduler" do - settings.Read - expect(settings.GetIOScheduler).to eq("") - end - end - - it "reads bootloader configuration" do - expect(Yast::Bootloader).to receive(:Read) - settings.Read - end - end - - context "but the bootloader cannot be read" do - let(:bootloader_read) { false } - - it "returns false" do - expect(settings.Read).to eq(false) - end - - it "does not set the scheduler" do - expect(subject).to_not receive(:SetIOScheduler) - end + it "I/O autoconfig is disabled" do + settings.Read + expect(settings.GetAutoConf).to eq(false) end end - context "is not in normal mode" do - let(:mode) { "installation" } + context "when rd.zdev kernel option is not set" do + let(:rd_zdev) { :missing } - it "does not read bootloader configuration" do - expect(Yast::Bootloader).to_not receive(:Read) + it "I/O autoconfig is enabled" do settings.Read + expect(settings.GetAutoConf).to eq(true) end end end describe "#Activate" do 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(File).to receive(:write).with(KERNEL_SYSRQ_FILE, anything) 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, disk2]) + allow(Dir).to receive(:[]).with("/usr/share/YaST2/locale/*").and_return([]) end context "when SysRq keys status is unknown" do @@ -184,55 +119,20 @@ end end - context "when a scheduler is set" do - let(:scheduler) { "cfq" } - - 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 + context "when I/O device autoconfig is enabled" do + it "removes rd.zdev kernel option" do expect(Yast::Bootloader).to receive(:modify_kernel_params) - .with("elevator" => scheduler) - expect(Yast::Bootloader).to receive(:proposed_cfg_changed=).with(true) - allow(File).to receive(:write) - settings.Activate - end - - 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) + .with("rd.zdev" => :missing) + settings.SetAutoConf(true) settings.Activate end end - context "when no scheduler is set" do - let(:scheduler) { "" } - - before do - allow(File).to receive(:write).with(KERNEL_SYSRQ_FILE, anything) - end - - it "removes parameter from bootloader configuration" do + context "when I/O device autoconfig is disabled" do + it "sets rd.zdev kernel option to no-auto" do expect(Yast::Bootloader).to receive(:modify_kernel_params) - .with("elevator" => :missing) - expect(Yast::Bootloader).to receive(:proposed_cfg_changed=).with(true) - settings.Activate - end - - it "does not activate scheduler" do - expect(File).to_not receive(:write).with(disk, anything) + .with("rd.zdev" => "no-auto") + settings.SetAutoConf(false) settings.Activate end end @@ -292,39 +192,6 @@ end end end - - describe "#SetIOScheduler" do - context "when scheduler is a known one" do - it "sets the scheduler to the given value" do - settings.SetIOScheduler("cfq") - expect(settings.GetIOScheduler).to eq("cfq") - end - end - - context "when scheduler is unknown" do - before do - settings.SetIOScheduler("cfq") - end - - it "does not modify the scheduler" do - settings.SetIOScheduler("some-scheduler") - expect(settings.GetIOScheduler).to eq("cfq") - end - end - - context "when new scheduler is different from previous one" do - before do - allow(Yast::Bootloader).to receive(:kernel_param) - .with(:common, "elevator").and_return("cfq") - settings.Read - end - - it "sets the module as modified" do - expect { settings.SetIOScheduler("noop") }.to change { settings.Modified } - .from(false).to(true) - end - end - end describe "#SetSysRqKeysEnabled" do before do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-tune-4.2.3/test/test_helper.rb new/yast2-tune-4.3.1/test/test_helper.rb --- old/yast2-tune-4.2.3/test/test_helper.rb 2020-04-07 12:54:05.000000000 +0200 +++ new/yast2-tune-4.3.1/test/test_helper.rb 2020-12-17 18:50:19.000000000 +0100 @@ -1,6 +1,15 @@ ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) require "yast" +require "yast/rspec" + +RSpec.configure do |config| + config.mock_with :rspec do |mocks| + # make sure we mock only the existing methods + mocks.verify_partial_doubles = true + end +end + if ENV["COVERAGE"] require "simplecov" @@ -12,12 +21,20 @@ # 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"] - require "coveralls" + # additionally use the LCOV format for on-line code coverage reporting at CI + if ENV["CI"] || ENV["COVERAGE_LCOV"] + require "simplecov-lcov" + + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + # this is the default Coveralls GitHub Action location + # https://github.com/marketplace/actions/coveralls-github-action + c.single_report_path = "coverage/lcov.info" + end + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter + SimpleCov::Formatter::LcovFormatter ] end end
participants (1)
-
User for buildservice source handling