[yast-commit] [ci_new_pac] JFYI yast2-network -> sle12
Script 'mail_helper' called by ro Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: ro. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-network -> sle12 ## BNC# 862378 : "Different names for same ethernet devices" (ASSIGNED/) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-network/yast2-network.changes 2014-02-10 11:47:07.000000000 +0100 +++ /mounts/work_src_done/SLE12/yast2-network/yast2-network.changes 2014-02-12 11:33:06.000000000 +0100 @@ -1,0 +2,7 @@ +Tue Feb 11 13:22:26 UTC 2014 - mfilka@suse.com + +- bnc#862378 + - Device name set according hwinfo when ifcfg["NAME"] is empty +- 3.1.19 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2-network - at least 14 other packages ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2-network (Old) and /mounts/work_src_done/SLE12/yast2-network (BS:build ID:32480 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-network", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-network-3.1.18.tar.bz2 New: ---- yast2-network-3.1.19.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.zv3ZhB/_old 2014-02-12 11:51:45.000000000 +0100 +++ /var/tmp/diff_new_pack.zv3ZhB/_new 2014-02-12 11:51:45.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.18 +Version: 3.1.19 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-network-3.1.18.tar.bz2 -> yast2-network-3.1.19.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/package/yast2-network.changes new/yast2-network-3.1.19/package/yast2-network.changes --- old/yast2-network-3.1.18/package/yast2-network.changes 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/package/yast2-network.changes 2014-02-12 11:30:23.000000000 +0100 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Feb 11 13:22:26 UTC 2014 - mfilka@suse.com + +- bnc#862378 + - Device name set according hwinfo when ifcfg["NAME"] is empty +- 3.1.19 + +------------------------------------------------------------------- Fri Feb 7 20:48:18 UTC 2014 - mfilka@suse.com - fate#315501 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/package/yast2-network.spec new/yast2-network-3.1.19/package/yast2-network.spec --- old/yast2-network-3.1.18/package/yast2-network.spec 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/package/yast2-network.spec 2014-02-12 11:30:23.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.18 +Version: 3.1.19 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/src/include/network/complex.rb new/yast2-network-3.1.19/src/include/network/complex.rb --- old/yast2-network-3.1.18/src/include/network/complex.rb 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/src/include/network/complex.rb 2014-02-12 11:30:23.000000000 +0100 @@ -40,7 +40,6 @@ Yast.import "Popup" Yast.import "String" Yast.import "Summary" - Yast.import "NetworkService" Yast.include include_target, "network/routines.rb" Yast.include include_target, "network/summary.rb" @@ -51,18 +50,14 @@ # Take the NAME field from ifcfg # If empty, identify the hardware and use its data def BuildDescription(devtype, devnum, devmap, _Hardware) - devmap = deep_copy(devmap) - _Hardware = deep_copy(_Hardware) - descr = Ops.get_string(devmap, "NAME", "") + descr = devmap["NAME"] || "" return descr if descr != "" descr = HardwareName(_Hardware, devnum) return descr if descr != "" - descr = HardwareName(_Hardware, Ops.get_string(devmap, "UNIQUE", "")) - return descr if descr != "" - descr = HardwareName(_Hardware, Ops.get_string(devmap, "dev_name", "")) + descr = HardwareName(_Hardware, devmap["UNIQUE"] || "") return descr if descr != "" - descr = CheckEmptyName(devtype, descr) - descr + + CheckEmptyName(devtype, descr) end # TODO move to HTML.ycp @@ -183,18 +178,12 @@ # create a table of unconfigured devices selected = Ops.get_integer(unconfigured, [0, "num"], -1) - # list devs = hwlist2items(unconfigured, selected); # FIXME OtherDevices(devs, type); - # Label for not detected devices - # devs = add(devs, `item(`id(`other), _("Other (not detected)"), size(devs) == 0)); - Builtins.y2debug("summary=%1", summary) - # y2debug("devs=%1", devs); - [summary, unconfigured] - # return [ summary, devs ]; + [summary, unconfigured] end # Build textual summary @@ -269,27 +258,34 @@ # Device type label _("Unknown Network Device") end + def HardwareName(_Hardware, id) - _Hardware = deep_copy(_Hardware) - hwname = "" - Builtins.foreach(_Hardware) do |h| + return "" if id.nil? || id.empty? + return "" if _Hardware.nil? || _Hardware.empty? + + # filter out a list of hwinfos which correspond to the given id + res_list = _Hardware.select do |h| have = [ - Ops.add("id-", Ops.get_string(h, "mac", "")), - Ops.add( - Ops.add("bus-", Ops.get_string(h, "bus", "")), - String.OptFormat("-%1", Ops.get_string(h, "busid", "")) - ), - Ops.get_string(h, "udi", ""), - Ops.get_string(h, "dev_name", "") + "id-" + (h["mac"] || ""), + "bus-" + (h["bus"] || "") + "-" + (h["busid"] || ""), + h["udi"] || "", + h["dev_name"] || "" ] - Builtins.y2debug("what: %1, have: %2", id, have) - if Builtins.contains(have, id) - hwname = Ops.get_string(h, "name", "") - raise Break - end - end if id != "" - Builtins.y2milestone("hwname=%1", hwname) - hwname + + have.include?(id) + end + + # take first item from the list - there should be just one + if res_list.empty? + Builtins.y2warning("HardwareName: no matching hardware for id=#{id}") + + return "" + else + hwname = res_list.first["name"] || "" + Builtins.y2milestone("HardwareName: hwname=#{hwname} for id=#{id}") + + return hwname + end end # Get aprovider name from the provider map @@ -339,13 +335,9 @@ devname, nam, proto - ) + ) - # example: ISDN Connection to Arcor with syncppp on net0 - # return sformat(_("to %1 with %2 on %3"), provider, proto, dev); else - # if(!regexpmatch(devtype, NetworkAllRegex)) - # y2error("Unknown type: %1", devtype); proto = Ops.get_string(devmap, "BOOTPROTO", "static") @@ -436,320 +428,5 @@ ip end - # Return description used for device summary dialog - # In case device is not connected "(not connected)" string - # will be added. - # Description also contains MAC address or BusID information. - - def getConnMacBusDescription(v, _Hardware) - v = deep_copy(v) - _Hardware = deep_copy(_Hardware) - descr = "" - conn = "" - mac_dev = "" - Builtins.foreach(_Hardware) do |device| - if Ops.get_string(v, "UNIQUE", "") == - Ops.get_string(device, "unique_key", "") - conn = HTML.Bold( - Ops.get_boolean(device, "link", false) == true ? - "" : - _("(not connected)") - ) - if Ops.greater_than( - Builtins.size(Ops.get_string(device, "mac", "")), - 0 - ) - mac_dev = Ops.add( - Ops.add(HTML.Bold("MAC : "), Ops.get_string(device, "mac", "")), - "<br>" - ) - elsif Ops.greater_than( - Builtins.size(Ops.get_string(device, "busid", "")), - 0 - ) - mac_dev = Ops.add( - Ops.add( - HTML.Bold("BusID : "), - Ops.get_string(device, "busid", "") - ), - "<br>" - ) - end - end - end - descr = Ops.add(Ops.add(Ops.add(" ", conn), "<br>"), mac_dev) - descr - end - - # Create overview table contents - # List of terms - # `item (`id (id), ...) - # @return table items - def BuildOverviewDevs(_Devs, _Hardware) - _Devs = deep_copy(_Devs) - _Hardware = deep_copy(_Hardware) - overview = [] - - startmode_descrs = { - # summary description of STARTMODE=auto - "auto" => _( - "Started automatically at boot" - ), - # summary description of STARTMODE=hotplug - "hotplug" => _( - "Started automatically at boot" - ), - # summary description of STARTMODE=ifplugd - "ifplugd" => _( - "Started automatically on cable connection" - ), - # summary description of STARTMODE=managed - "managed" => _( - "Managed by NetworkManager" - ), - # summary description of STARTMODE=off - "off" => _( - "Will not be started at all" - ) - } - - Builtins.maplist(_Devs) do |type, devmap| - Builtins.maplist( - Convert.convert(devmap, :from => "map", :to => "map <string, map>") - ) do |devname, v| - item = nil - ip = DeviceProtocol(v) - descr = BuildDescription(type, devname, v, _Hardware) - startmode_descr = Ops.get_locale( - startmode_descrs, - Ops.get_string(v, "STARTMODE", ""), - _("Started manually") - ) - # Modem and DSL - if type == "ppp" || type == "modem" || type == "dsl" - # create the rich text description - rich = Ops.add( - Ops.add(HTML.Bold(descr), "<br>"), - HTML.List( - [ - Builtins.sformat(_("Device Name: %1"), devname), - Builtins.sformat( - _("Mode: %1"), - Ops.get_locale(v, "PPPMODE", _("Unknown")) - ), - startmode_descr - ] - ) - ) - item = Item( - Id(devname), - devname, - NetworkInterfaces.GetDevTypeDescription(type, false), - ProviderName(Ops.get_string(v, "PROVIDER", "")), - rich - ) - # ISDN stuff - elsif type == "contr" - # FIXME: richtext - cname = Ops.get_string(v, "NAME", "unknown") - item = Item( - Id(devname), #, "active?", ip, "?", "?" - devname, - NetworkInterfaces.GetDevTypeDescription(type, false), - cname - ) - # ISDN stuff - elsif type == "net" - # FIXME: richtext - cname = Ops.get_string(v, "PROVIDER", "unknown") - rip = Ops.get_string(v, "PTPADDR", "none") - proto = Ops.get_string(v, "PROTOCOL", "unknown") - item = Item(Id(devname), devname, proto, cname, ip, rip) - else - # if(!regexpmatch(type, NetworkAllRegex)) - # y2error("Unknown type: %1", type); - - bullets = [ - Builtins.sformat(_("Device Name: %1"), devname), - startmode_descr - ] - if Ops.get_string(v, "STARTMODE", "") != "managed" - if ip != "NONE" - bullets = Ops.add( - bullets, - [ - ip == "DHCP" ? - _("IP address assigned using DHCP") : - Builtins.sformat( - _("IP address: %1, subnet mask %2"), - ip, - Ops.get_string(v, "NETMASK", "") - ) - ] - ) - end - - # build aliases overview - if Ops.greater_than( - Builtins.size(Ops.get_map(v, "_aliases", {})), - 0 - ) && - !NetworkService.is_network_manager - Builtins.foreach(Ops.get_map(v, "_aliases", {})) do |key, desc| - parameters = Builtins.sformat( - _("IP address: %1, subnet mask %2"), - Ops.get_string(desc, "IPADDR", ""), - Ops.get_string(desc, "NETMASK", "") - ) - bullets = Builtins.add( - bullets, - Builtins.sformat("%1 (%2)", key, parameters) - ) - end - end - end - - # build the "Bond Slaves" entry of rich box - if type == "bond" - slaves = "" - Builtins.foreach( - Convert.convert(v, :from => "map", :to => "map <string, any>") - ) do |key, value| - if value != nil && - Builtins.regexpmatch(key, "BONDING_SLAVE[0-9]") - slaves = Ops.add( - Ops.add(slaves, slaves != "" ? ", " : ""), - Convert.to_string(value) - ) - end - end - if slaves != "" - bullets = Ops.add( - bullets, - [Ops.add(_("Bond slaves") + " : ", slaves)] - ) - end - end - - rich = descr - rich = Ops.add( - Ops.add(HTML.Bold(rich), getConnMacBusDescription(v, _Hardware)), - HTML.List(bullets) - ) - hw_id = -1 - found = false - Builtins.foreach(_Hardware) do |device| - hw_id = Ops.add(hw_id, 1) - if Ops.get_string(v, "UNIQUE", "") == - Ops.get_string(device, "unique_key", "") - found = true - raise Break - end - end - - item = Item(Id(devname), descr, ip, rich, found ? hw_id : -1) - end - overview = Builtins.add(overview, item) - end - end - - Builtins.y2debug("overview=%1", overview) - deep_copy(overview) - end - - # Create overview table contents - # @return table items - def BuildOverview(devregex, _Hardware) - _Hardware = deep_copy(_Hardware) - _Devs = NetworkInterfaces.FilterDevices(devregex) - BuildOverviewDevs(_Devs, _Hardware) - end - - # Convert the output of BuildSummary for inclusion in the unified device list. - # Called by BuildUnconfigured and BuildUnconfiguredDevs. - # @param [Array] sum output of BuildSumary - # @param [String] class netcard modem dsl, isdn too; - # determines how to arrange output, yuck - # @return [ $[id, table_descr, rich descr] ] - def BuildUnconfiguredCommon(sum, _class) - sum = deep_copy(sum) - # unconfigured devices - # list<term> res = sum[1]:[`item(`id(`other))]; - # filter out the item for adding an unknown one - # list res = filter (term card, sum, ``( card[0,0]:nil != `other )); - # translators: this device has not been configured yet - nc = _("Not configured") - Builtins.maplist( - Convert.convert(sum, :from => "list", :to => "list <map <string, any>>") - ) do |card| - # configured cards are identified by the string after ifcfg-, - # unconfigured ones by "-%1" where %1 is the index in hardware list - id = Builtins.sformat("-%1", Ops.get_integer(card, "id", 0)) - name = Ops.get_string(card, "name", "") - desc = [] - case _class - when "netcard" - desc = [name, nc] - when "dsl", "modem" - desc = [ - name, - NetworkInterfaces.GetDevTypeDescription(_class, false), - nc - ] - when "isdn" - desc = [ - nc, - NetworkInterfaces.GetDevTypeDescription(_class, false), - name - ] - else - Builtins.y2warning(1, "invalid class %1", _class) - end - rich = Ops.add( - Ops.add( - HTML.Bold(name), - getConnMacBusDescription( - card, - Convert.convert(sum, :from => "list", :to => "list <map>") - ) - ), - _( - "<p>The device is not configured. Press <b>Edit</b> for configuration.</p>" - ) - ) - { "id" => id, "table_descr" => desc, "rich_descr" => rich } - end - end - - # @param [Hash{String => map}] Devs configured devices - # @param [String] class netcard modem dsl, isdn too - # @param [Array<Hash>] Hardware the detected hardware - # @return [ $[id, table_descr, rich descr] ] - def BuildUnconfiguredDevs(_Devs, _class, _Hardware) - _Devs = deep_copy(_Devs) - _Hardware = deep_copy(_Hardware) - split = true - proposal = false - sum = BuildSummaryDevs(_Devs, _Hardware, split, proposal) - BuildUnconfiguredCommon( - Ops.get_list(sum, Ops.subtract(Builtins.size(sum), 1), []), - _class - ) - end - - # @param [String] class netcard modem dsl. not isdn because it does not use - # NetworkInterfaces (#103073) - # @param [Array<Hash>] Hardware the detected hardware - # @return [ $[id, table_descr, rich descr] ] - def BuildUnconfigured(_class, _Hardware) - _Hardware = deep_copy(_Hardware) - split = true - proposal = false - sum = BuildSummary(_class, _Hardware, split, proposal) - BuildUnconfiguredCommon( - Ops.get_list(sum, Ops.subtract(Builtins.size(sum), 1), []), - _class - ) - end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/src/include/network/routines.rb new/yast2-network-3.1.19/src/include/network/routines.rb --- old/yast2-network-3.1.18/src/include/network/routines.rb 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/src/include/network/routines.rb 2014-02-12 11:30:23.000000000 +0100 @@ -389,15 +389,6 @@ need end - def busid_to_sysfs_id(busid, hardware) - hardware = deep_copy(hardware) - # hardware is cached list of netcards - hw_item = Builtins.find(hardware) do |i| - Ops.get_string(i, "busid", "") == busid - end - Ops.get_string(hw_item, "sysfs_id", "") - end - def dev_name_to_sysfs_id(dev_name, hardware) hardware = deep_copy(hardware) # hardware is cached list of netcards diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/src/modules/LanItems.rb new/yast2-network-3.1.19/src/modules/LanItems.rb --- old/yast2-network-3.1.18/src/modules/LanItems.rb 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/src/modules/LanItems.rb 2014-02-12 11:30:23.000000000 +0100 @@ -254,7 +254,6 @@ "WIRELESS_BITRATE" => "auto", "WIRELESS_AP" => "", "WIRELESS_POWER" => "", - # aliases = devmap["_aliases"]:$[]; // ? "WIRELESS_EAP_MODE" => "", "WIRELESS_WPA_IDENTITY" => "", "WIRELESS_WPA_PASSWORD" => "", @@ -399,7 +398,6 @@ Builtins.y2milestone("Reading driver options ...") Builtins.foreach(SCR.Dir(path(".modules.options"))) do |driver| pth = Builtins.sformat(".modules.options.%1", driver) - # driver_options[driver] = SCR::Read(topath(pth)); Builtins.foreach( Convert.convert( SCR.Read(Builtins.topath(pth)), @@ -1226,15 +1224,9 @@ Ops.get_string(@Items, [key, "ifcfg"], "") ) end - descr = BuildDescription( - @type, - NetworkInterfaces.GetType( - Ops.get_string(@Items, [key, "ifcfg"], "") - ), - NetworkInterfaces.Current, - [Ops.get_map(@Items, [key, "hwinfo"], {})] - ) - dev = NetworkInterfaces.Name #NetworkInterfaces::device_name(type, NetworkInterfaces::Name); + ifcfg_desc = GetDeviceMap(key)["NAME"] + descr = ifcfg_desc if !ifcfg_desc.nil? && !ifcfg_desc.empty? + dev = NetworkInterfaces.Name ip = DeviceProtocol(NetworkInterfaces.Current) status = DeviceStatus( @type, @@ -1480,7 +1472,6 @@ # @param hw the component def SelectHWMap(hardware) hardware = deep_copy(hardware) - # sysfs_id = hardware["sysfs_id"]:""; sel = SelectHardwareMap(hardware) # common stuff @@ -1949,7 +1940,6 @@ # set LLADDR to sysconfig only for device on layer2 and only these which needs it if @qeth_layer2 busid = Ops.get_string(@Items, [@current, "hwinfo", "busid"], "") - # string sysfs_id = busid_to_sysfs_id(busid, Hardware); # sysfs id has changed from css0... sysfs_id = Ops.add("/devices/qeth/", busid) Builtins.y2milestone("busid %1", busid) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/test/netcard_test.rb new/yast2-network-3.1.19/test/netcard_test.rb --- old/yast2-network-3.1.18/test/netcard_test.rb 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/test/netcard_test.rb 2014-02-12 11:30:23.000000000 +0100 @@ -2,60 +2,69 @@ ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +HWINFO_DEVICE_DESC = "Intel Ethernet controller" +HWINFO_DEVICE_MAC = "00:01:02:03:04:05" +HWINFO_DEVICE_BUS = "pci" +HWINFO_DEVICE_BUSID = "0000:00:19.0" +HWINFO_DEVICE_NAME = "eth11" # hwinfo is based on real hwinfo netcard output MOCKED_ITEMS = { # present but unconfigured devices - 0=>{ - "hwinfo"=>{ - "name"=>"Intel Ethernet controller", - "type"=>"eth", - "udi"=>"", - "sysfs_id"=>"/devices/pci0000:00/0000:00:19.0", - "dev_name"=>"eth11", - "requires"=>[], - "modalias"=>"pci:v00008086d00001502sv000017AAsd000021F3bc02sc00i00", - "unique"=>"rBUF.41x4AT4gee2", - "driver"=>"e1000e", - "num"=>0, - "drivers"=>[ + 0 => { + "hwinfo" => { + "name" => HWINFO_DEVICE_DESC, + "type" => "eth", + "udi" => "", + "sysfs_id" => "/devices/pci0000:00/0000:00:19.0", + "dev_name" => HWINFO_DEVICE_NAME, + "requires" => [], + "modalias" => "pci:v00008086d00001502sv000017AAsd000021F3bc02sc00i00", + "unique" => "rBUF.41x4AT4gee2", + "driver" => "e1000e", + "num" => 0, + "drivers" => [ { - "active"=>true, - "modprobe"=>true, - "modules"=>[ + "active" => true, + "modprobe" => true, + "modules" => [ [ - "e1000e", + "e1000e", "" ] ] } - ], - "active"=>true, - "module"=>"e1000e", - "options"=>"", - "bus"=>"pci", - "busid"=>"0000:00:19.0", - "mac"=>"00:01:02:03:04:05", - "link"=>nil, - "wl_channels"=>nil, - "wl_bitrates"=>nil, - "wl_auth_modes"=>nil, - "wl_enc_modes"=>nil - }, - "udev"=>{ - "net"=>[], - "driver"=>"" + ], + "active" => true, + "module" => "e1000e", + "options" => "", + "bus" => HWINFO_DEVICE_BUS, + "busid" => HWINFO_DEVICE_BUSID, + "mac" => HWINFO_DEVICE_MAC, + "link" => nil, + "wl_channels" => nil, + "wl_bitrates" => nil, + "wl_auth_modes" => nil, + "wl_enc_modes" => nil + }, + "udev" => { + "net" => [], + "driver" => "" } - }, + }, # devices with configuration, but not present - 1=>{"ifcfg"=>"bond0"}, - 2=>{"ifcfg"=>"eth1"}, - 3=>{"ifcfg"=>"br0"}, - 4=>{"ifcfg"=>"tun0"}, - 5=>{"ifcfg"=>"tap0"} + 1 => {"ifcfg" => "bond0"}, + 2 => {"ifcfg" => "eth1"}, + 3 => {"ifcfg" => "br0"}, + 4 => {"ifcfg" => "tun0"}, + 5 => {"ifcfg" => "tap0"} } require "yast" +include Yast +include UIShortcuts +include I18n + Yast.import "LanItems" describe "When querying netcard device name" do @@ -65,7 +74,7 @@ # mocking only neccessary parts of Yast::LanItems so we need not to call # and mock inputs for Yast::LanItems.Read here - @lan_items.Items = MOCKED_ITEMS + @lan_items.Items = MOCKED_ITEMS end it "returns empty list when querying device name with nil or empty input" do @@ -78,3 +87,43 @@ expect(@lan_items.GetNetcardNames.sort).to eq expected_names end end + +describe "NetworkComplexInclude#HardwareName" do + + before(:each) do + Yast.include self, "network/complex.rb" + + @hwinfo = MOCKED_ITEMS[0]["hwinfo"] + @expected_desc = HWINFO_DEVICE_DESC + end + + it "returns expected name when querying oldfashioned mac based id" do + expect(HardwareName([@hwinfo], "id-#{HWINFO_DEVICE_MAC}")) + .to be_eql @expected_desc + end + + it "returns expected name when querying oldfashioned bus based id" do + busid = "bus-#{HWINFO_DEVICE_BUS}-#{HWINFO_DEVICE_BUSID}" + expect(HardwareName([@hwinfo], busid)) + .to be_eql @expected_desc + end + + it "returns expected name when querying by device name" do + expect(HardwareName([@hwinfo], HWINFO_DEVICE_NAME)) + .to be_eql @expected_desc + end + + it "returns empty string when id is not given" do + expect(HardwareName(@hwinfo, nil)).to be_empty + expect(HardwareName(@hwinfo, "")).to be_empty + end + + it "returns empty string when no hwinfo is available" do + expect(HardwareName(nil, HWINFO_DEVICE_NAME)).to be_empty + expect(HardwareName([], HWINFO_DEVICE_NAME)).to be_empty + end + + it "returns empty string when querying unknown id" do + expect(HardwareName(@hwinfo, "unknown")).to be_empty + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/testsuite/tests/complex.out new/yast2-network-3.1.19/testsuite/tests/complex.out --- old/yast2-network-3.1.18/testsuite/tests/complex.out 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/testsuite/tests/complex.out 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -Dump HardwareName -Return -Return hwtest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.18/testsuite/tests/complex.rb new/yast2-network-3.1.19/testsuite/tests/complex.rb --- old/yast2-network-3.1.18/testsuite/tests/complex.rb 2014-02-10 11:25:33.000000000 +0100 +++ new/yast2-network-3.1.19/testsuite/tests/complex.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -# encoding: utf-8 - -#*************************************************************************** -# -# Copyright (c) 2012 Novell, Inc. -# All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of version 2 of the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, contact Novell, Inc. -# -# To contact Novell about this file by physical or electronic mail, -# you may find current contact information at www.novell.com -# -#************************************************************************** -module Yast - class ComplexClient < Client - def main - Yast.import "UI" - - # testedfiles: complex.ycp Testsuite.ycp - Yast.import "Testsuite" - @READ = { "target" => { "tmpdir" => "/tmp", "stat" => {} } } - Testsuite.Init([@READ], 0) - - @Devs = {} - Yast.include self, "network/complex.rb" - - @Hardware = [{ "bus" => "pci", "busid" => "1234", "name" => "hwtest" }] - - Testsuite.Dump("HardwareName") - Testsuite.Test(lambda { HardwareName(@Hardware, "") }, [], nil) - Testsuite.Test(lambda { HardwareName(@Hardware, "bus-pci-1234") }, [], nil) - - nil - end - end -end - -Yast::ComplexClient.new.main continue with "q"... Checked in at Wed Feb 12 11:51:59 CET 2014 by ro Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
ro