How to use linux method of Platform Package

Best Selenium code snippet using Platform.linux

test_gem_commands_query_command.rb

Source:test_gem_commands_query_command.rb Github

copy

Full Screen

...23    end24    expected = <<-EOF25*** REMOTE GEMS ***26a (2)27pl (1 i386-linux)28    EOF29    assert_equal expected, @ui.output30    assert_equal '', @ui.error31  end32  def test_execute_platform33    spec_fetcher do |fetcher|34      fetcher.clear35      fetcher.spec 'a', 136      fetcher.spec 'a', 1 do |s|37        s.platform = 'x86-linux'38      end39      fetcher.spec 'a', 2 do |s|40        s.platform = 'universal-darwin'41      end42    end43    @cmd.handle_options %w[-r -a]44    use_ui @ui do45      @cmd.execute46    end47    expected = <<-EOF48*** REMOTE GEMS ***49a (2 universal-darwin, 1 ruby x86-linux)50    EOF51    assert_equal expected, @ui.output52    assert_equal '', @ui.error53  end54  def test_execute_all55    spec_fetcher do |fetcher|56      fetcher.legacy_platform57    end58    @cmd.handle_options %w[-r --all]59    use_ui @ui do60      @cmd.execute61    end62    expected = <<-EOF63*** REMOTE GEMS ***64a (2, 1)65pl (1 i386-linux)66    EOF67    assert_equal expected, @ui.output68    assert_equal '', @ui.error69  end70  def test_execute_all_prerelease71    spec_fetcher do |fetcher|72      fetcher.legacy_platform73    end74    @cmd.handle_options %w[-r --all --prerelease]75    use_ui @ui do76      @cmd.execute77    end78    expected = <<-EOF79*** REMOTE GEMS ***80a (3.a, 2, 1)81pl (1 i386-linux)82    EOF83    assert_equal expected, @ui.output84    assert_equal '', @ui.error85  end86  def test_execute_details87    spec_fetcher do |fetcher|88      fetcher.spec 'a', 2 do |s|89        s.summary = 'This is a lot of text. ' * 490        s.authors = ['Abraham Lincoln', 'Hirohito']91        s.homepage = 'http://a.example.com/'92      end93      fetcher.legacy_platform94    end95    @cmd.handle_options %w[-r -d]96    use_ui @ui do97      @cmd.execute98    end99    expected = <<-EOF100*** REMOTE GEMS ***101a (2)102    Authors: Abraham Lincoln, Hirohito103    Homepage: http://a.example.com/104    This is a lot of text. This is a lot of text. This is a lot of text.105    This is a lot of text.106pl (1)107    Platform: i386-linux108    Author: A User109    Homepage: http://example.com110    this is a summary111    EOF112    assert_equal expected, @ui.output113    assert_equal '', @ui.error114  end115  def test_execute_details_platform116    spec_fetcher do |fetcher|117      fetcher.clear118      fetcher.spec 'a', 1 do |s|119        s.platform = 'x86-linux'120      end121      fetcher.spec 'a', 2 do |s|122        s.summary = 'This is a lot of text. ' * 4123        s.authors = ['Abraham Lincoln', 'Hirohito']124        s.homepage = 'http://a.example.com/'125        s.platform = 'universal-darwin'126      end127      fetcher.legacy_platform128    end129    @cmd.handle_options %w[-r -d]130    use_ui @ui do131      @cmd.execute132    end133    expected = <<-EOF134*** REMOTE GEMS ***135a (2, 1)136    Platforms:137        1: x86-linux138        2: universal-darwin139    Authors: Abraham Lincoln, Hirohito140    Homepage: http://a.example.com/141    This is a lot of text. This is a lot of text. This is a lot of text.142    This is a lot of text.143pl (1)144    Platform: i386-linux145    Author: A User146    Homepage: http://example.com147    this is a summary148    EOF149    assert_equal expected, @ui.output150    assert_equal '', @ui.error151  end152  def test_execute_installed153    @cmd.handle_options %w[-n a --installed]154    assert_raises Gem::MockGemUi::SystemExitException do155      use_ui @ui do156        @cmd.execute157      end158    end159    assert_equal "true\n", @ui.output160    assert_equal '', @ui.error161  end162  def test_execute_installed_inverse163    @cmd.handle_options %w[-n a --no-installed]164    e = assert_raises Gem::MockGemUi::TermError do165      use_ui @ui do166        @cmd.execute167      end168    end169    assert_equal "false\n", @ui.output170    assert_equal '', @ui.error171    assert_equal 1, e.exit_code172  end173  def test_execute_installed_inverse_not_installed174    @cmd.handle_options %w[-n not_installed --no-installed]175    assert_raises Gem::MockGemUi::SystemExitException do176      use_ui @ui do177        @cmd.execute178      end179    end180    assert_equal "true\n", @ui.output181    assert_equal '', @ui.error182  end183  def test_execute_installed_no_name184    @cmd.handle_options %w[--installed]185    e = assert_raises Gem::MockGemUi::TermError do186      use_ui @ui do187        @cmd.execute188      end189    end190    assert_equal '', @ui.output191    assert_equal "ERROR:  You must specify a gem name\n", @ui.error192    assert_equal 4, e.exit_code193  end194  def test_execute_installed_not_installed195    @cmd.handle_options %w[-n not_installed --installed]196    e = assert_raises Gem::MockGemUi::TermError do197      use_ui @ui do198        @cmd.execute199      end200    end201    assert_equal "false\n", @ui.output202    assert_equal '', @ui.error203    assert_equal 1, e.exit_code204  end205  def test_execute_installed_version206    @cmd.handle_options %w[-n a --installed --version 2]207    assert_raises Gem::MockGemUi::SystemExitException do208      use_ui @ui do209        @cmd.execute210      end211    end212    assert_equal "true\n", @ui.output213    assert_equal '', @ui.error214  end215  def test_execute_installed_version_not_installed216    @cmd.handle_options %w[-n c --installed --version 2]217    e = assert_raises Gem::MockGemUi::TermError do218      use_ui @ui do219        @cmd.execute220      end221    end222    assert_equal "false\n", @ui.output223    assert_equal '', @ui.error224    assert_equal 1, e.exit_code225  end226  def test_execute_local227    spec_fetcher do |fetcher|228      fetcher.legacy_platform229    end230    @cmd.options[:domain] = :local231    use_ui @ui do232      @cmd.execute233    end234    expected = <<-EOF235*** LOCAL GEMS ***236a (3.a, 2, 1)237pl (1 i386-linux)238    EOF239    assert_equal expected, @ui.output240    assert_equal '', @ui.error241  end242  def test_execute_local_notty243    spec_fetcher do |fetcher|244      fetcher.legacy_platform245    end246    @cmd.handle_options %w[]247    @ui.outs.tty = false248    use_ui @ui do249      @cmd.execute250    end251    expected = <<-EOF252a (3.a, 2, 1)253pl (1 i386-linux)254    EOF255    assert_equal expected, @ui.output256    assert_equal '', @ui.error257  end258  def test_execute_local_quiet259    spec_fetcher do |fetcher|260      fetcher.legacy_platform261    end262    @cmd.options[:domain] = :local263    Gem.configuration.verbose = false264    use_ui @ui do265      @cmd.execute266    end267    expected = <<-EOF268a (3.a, 2, 1)269pl (1 i386-linux)270    EOF271    assert_equal expected, @ui.output272    assert_equal '', @ui.error273  end274  def test_execute_no_versions275    spec_fetcher do |fetcher|276      fetcher.legacy_platform277    end278    @cmd.handle_options %w[-r --no-versions]279    use_ui @ui do280      @cmd.execute281    end282    expected = <<-EOF283*** REMOTE GEMS ***284a285pl286    EOF287    assert_equal expected, @ui.output288    assert_equal '', @ui.error289  end290  def test_execute_notty291    spec_fetcher do |fetcher|292      fetcher.legacy_platform293    end294    @cmd.handle_options %w[-r]295    @ui.outs.tty = false296    use_ui @ui do297      @cmd.execute298    end299    expected = <<-EOF300a (2)301pl (1 i386-linux)302    EOF303    assert_equal expected, @ui.output304    assert_equal '', @ui.error305  end306  def test_execute_prerelease307    @cmd.handle_options %w[-r --prerelease]308    use_ui @ui do309      @cmd.execute310    end311    expected = <<-EOF312*** REMOTE GEMS ***313a (3.a)314    EOF315    assert_equal expected, @ui.output316    assert_equal '', @ui.error317  end318  def test_execute_prerelease_local319    spec_fetcher do |fetcher|320      fetcher.legacy_platform321    end322    @cmd.handle_options %w[-l --prerelease]323    use_ui @ui do324      @cmd.execute325    end326    expected = <<-EOF327*** LOCAL GEMS ***328a (3.a, 2, 1)329pl (1 i386-linux)330    EOF331    assert_equal expected, @ui.output332    assert_equal "WARNING:  prereleases are always shown locally\n", @ui.error333  end334  def test_execute_remote335    spec_fetcher do |fetcher|336      fetcher.legacy_platform337    end338    @cmd.options[:domain] = :remote339    use_ui @ui do340      @cmd.execute341    end342    expected = <<-EOF343*** REMOTE GEMS ***344a (2)345pl (1 i386-linux)346    EOF347    assert_equal expected, @ui.output348    assert_equal '', @ui.error349  end350  def test_execute_remote_notty351    spec_fetcher do |fetcher|352      fetcher.legacy_platform353    end354    @cmd.handle_options %w[]355    @ui.outs.tty = false356    use_ui @ui do357      @cmd.execute358    end359    expected = <<-EOF360a (3.a, 2, 1)361pl (1 i386-linux)362    EOF363    assert_equal expected, @ui.output364    assert_equal '', @ui.error365  end366  def test_execute_remote_quiet367    spec_fetcher do |fetcher|368      fetcher.legacy_platform369    end370    @cmd.options[:domain] = :remote371    Gem.configuration.verbose = false372    use_ui @ui do373      @cmd.execute374    end375    expected = <<-EOF376a (2)377pl (1 i386-linux)378    EOF379    assert_equal expected, @ui.output380    assert_equal '', @ui.error381  end382  def test_execute_local_details383    spec_fetcher do |fetcher|384      fetcher.clear385      fetcher.spec 'a', 1 do |s|386        s.platform = 'x86-linux'387      end388      fetcher.spec 'a', 2 do |s|389        s.summary = 'This is a lot of text. ' * 4390        s.authors = ['Abraham Lincoln', 'Hirohito']391        s.homepage = 'http://a.example.com/'392        s.platform = 'universal-darwin'393      end394      fetcher.legacy_platform395    end396    @cmd.handle_options %w[-l -d]397    use_ui @ui do398      @cmd.execute399    end400    str = @ui.output401    str.gsub!(/\(\d\): [^\n]*/, "-")402    str.gsub!(/at: [^\n]*/, "at: -")403    expected = <<-EOF404*** LOCAL GEMS ***405a (2, 1)406    Platforms:407        1: x86-linux408        2: universal-darwin409    Authors: Abraham Lincoln, Hirohito410    Homepage: http://a.example.com/411    Installed at -412                 -413    This is a lot of text. This is a lot of text. This is a lot of text.414    This is a lot of text.415pl (1)416    Platform: i386-linux417    Author: A User418    Homepage: http://example.com419    Installed at: -420    this is a summary421    EOF422    assert_equal expected, @ui.output423  end424  def test_execute_default_details425    spec_fetcher do |fetcher|426      fetcher.clear427      fetcher.spec 'a', 2428    end429    a1 = new_default_spec 'a', 1430    install_default_specs a1...

Full Screen

Full Screen

test_gem_platform.rb

Source:test_gem_platform.rb Github

copy

Full Screen

...29      'universal-dotnet4.0'    => ['universal', 'dotnet',  '4.0'],30      'powerpc-aix5.3.0.0'     => ['powerpc',   'aix',       '5'],31      'powerpc-darwin7'        => ['powerpc',   'darwin',    '7'],32      'powerpc-darwin8'        => ['powerpc',   'darwin',    '8'],33      'powerpc-linux'          => ['powerpc',   'linux',     nil],34      'powerpc64-linux'        => ['powerpc64', 'linux',     nil],35      'sparc-solaris2.10'      => ['sparc',     'solaris',   '2.10'],36      'sparc-solaris2.8'       => ['sparc',     'solaris',   '2.8'],37      'sparc-solaris2.9'       => ['sparc',     'solaris',   '2.9'],38      'universal-darwin8'      => ['universal', 'darwin',    '8'],39      'universal-darwin9'      => ['universal', 'darwin',    '9'],40      'universal-macruby'      => ['universal', 'macruby',   nil],41      'i386-cygwin'            => ['x86',       'cygwin',    nil],42      'i686-darwin'            => ['x86',       'darwin',    nil],43      'i686-darwin8.4.1'       => ['x86',       'darwin',    '8'],44      'i386-freebsd4.11'       => ['x86',       'freebsd',   '4'],45      'i386-freebsd5'          => ['x86',       'freebsd',   '5'],46      'i386-freebsd6'          => ['x86',       'freebsd',   '6'],47      'i386-freebsd7'          => ['x86',       'freebsd',   '7'],48      'i386-freebsd'           => ['x86',       'freebsd',   nil],49      'universal-freebsd'      => ['universal', 'freebsd',   nil],50      'i386-java1.5'           => ['x86',       'java',      '1.5'],51      'x86-java1.6'            => ['x86',       'java',      '1.6'],52      'i386-java1.6'           => ['x86',       'java',      '1.6'],53      'i686-linux'             => ['x86',       'linux',     nil],54      'i586-linux'             => ['x86',       'linux',     nil],55      'i486-linux'             => ['x86',       'linux',     nil],56      'i386-linux'             => ['x86',       'linux',     nil],57      'i586-linux-gnu'         => ['x86',       'linux',     nil],58      'i386-linux-gnu'         => ['x86',       'linux',     nil],59      'i386-mingw32'           => ['x86',       'mingw32',   nil],60      'i386-mswin32'           => ['x86',       'mswin32',   nil],61      'i386-mswin32_80'        => ['x86',       'mswin32',   '80'],62      'i386-mswin32-80'        => ['x86',       'mswin32',   '80'],63      'x86-mswin32'            => ['x86',       'mswin32',   nil],64      'x86-mswin32_60'         => ['x86',       'mswin32',   '60'],65      'x86-mswin32-60'         => ['x86',       'mswin32',   '60'],66      'i386-netbsdelf'         => ['x86',       'netbsdelf', nil],67      'i386-openbsd4.0'        => ['x86',       'openbsd',   '4.0'],68      'i386-solaris2.10'       => ['x86',       'solaris',   '2.10'],69      'i386-solaris2.8'        => ['x86',       'solaris',   '2.8'],70      'mswin32'                => ['x86',       'mswin32',   nil],71      'x86_64-linux'           => ['x86_64',    'linux',     nil],72      'x86_64-openbsd3.9'      => ['x86_64',    'openbsd',   '3.9'],73      'x86_64-openbsd4.0'      => ['x86_64',    'openbsd',   '4.0'],74      'x86_64-openbsd'         => ['x86_64',    'openbsd',   nil],75    }76    test_cases.each do |arch, expected|77      platform = Gem::Platform.new arch78      assert_equal expected, platform.to_a, arch.inspect79    end80  end81  def test_initialize_command_line82    expected = ['x86', 'mswin32', nil]83    platform = Gem::Platform.new 'i386-mswin32'84    assert_equal expected, platform.to_a, 'i386-mswin32'85    expected = ['x86', 'mswin32', '80']86    platform = Gem::Platform.new 'i386-mswin32-80'87    assert_equal expected, platform.to_a, 'i386-mswin32-80'88    expected = ['x86', 'solaris', '2.10']89    platform = Gem::Platform.new 'i386-solaris-2.10'90    assert_equal expected, platform.to_a, 'i386-solaris-2.10'91  end92  def test_initialize_mswin32_vc693    orig_RUBY_SO_NAME = RbConfig::CONFIG['RUBY_SO_NAME']94    RbConfig::CONFIG['RUBY_SO_NAME'] = 'msvcrt-ruby18'95    expected = ['x86', 'mswin32', nil]96    platform = Gem::Platform.new 'i386-mswin32'97    assert_equal expected, platform.to_a, 'i386-mswin32 VC6'98  ensure99    RbConfig::CONFIG['RUBY_SO_NAME'] = orig_RUBY_SO_NAME100  end101  def test_initialize_platform102    platform = Gem::Platform.new 'cpu-my_platform1'103    assert_equal 'cpu', platform.cpu104    assert_equal 'my_platform', platform.os105    assert_equal '1', platform.version106  end107  def test_initialize_test108    platform = Gem::Platform.new 'cpu-my_platform1'109    assert_equal 'cpu', platform.cpu110    assert_equal 'my_platform', platform.os111    assert_equal '1', platform.version112    platform = Gem::Platform.new 'cpu-other_platform1'113    assert_equal 'cpu', platform.cpu114    assert_equal 'other_platform', platform.os115    assert_equal '1', platform.version116  end117  def test_to_s118    if win_platform? then119      assert_equal 'x86-mswin32-60', Gem::Platform.local.to_s120    else121      assert_equal 'x86-darwin-8', Gem::Platform.local.to_s122    end123  end124  def test_equals2125    my = Gem::Platform.new %w[cpu my_platform 1]126    other = Gem::Platform.new %w[cpu other_platform 1]127    assert_equal my, my128    refute_equal my, other129    refute_equal other, my130  end131  def test_equals3132    my = Gem::Platform.new %w[cpu my_platform 1]133    other = Gem::Platform.new %w[cpu other_platform 1]134    assert(my === my)135    refute(other === my)136    refute(my === other)137  end138  def test_equals3_cpu139    ppc_darwin8 = Gem::Platform.new 'powerpc-darwin8.0'140    uni_darwin8 = Gem::Platform.new 'universal-darwin8.0'141    x86_darwin8 = Gem::Platform.new 'i686-darwin8.0'142    util_set_arch 'powerpc-darwin8'143    assert((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')144    assert((uni_darwin8 === Gem::Platform.local), 'powerpc =~ universal')145    refute((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')146    util_set_arch 'i686-darwin8'147    refute((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')148    assert((uni_darwin8 === Gem::Platform.local), 'x86 =~ universal')149    assert((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')150    util_set_arch 'universal-darwin8'151    assert((ppc_darwin8 === Gem::Platform.local), 'universal =~ ppc')152    assert((uni_darwin8 === Gem::Platform.local), 'universal =~ universal')153    assert((x86_darwin8 === Gem::Platform.local), 'universal =~ x86')154  end155  def test_equals3_cpu_arm156    arm   = Gem::Platform.new 'arm-linux'157    armv5 = Gem::Platform.new 'armv5-linux'158    armv7 = Gem::Platform.new 'armv7-linux'159    util_set_arch 'armv5-linux'160    assert((arm   === Gem::Platform.local), 'arm   === armv5')161    assert((armv5 === Gem::Platform.local), 'armv5 === armv5')162    refute((armv7 === Gem::Platform.local), 'armv7 === armv5')163    refute((Gem::Platform.local ===   arm), 'armv5 === arm')164    util_set_arch 'armv7-linux'165    assert((arm   === Gem::Platform.local), 'arm   === armv7')166    refute((armv5 === Gem::Platform.local), 'armv5 === armv7')167    assert((armv7 === Gem::Platform.local), 'armv7 === armv7')168    refute((Gem::Platform.local ===   arm), 'armv7 === arm')169  end170  def test_equals3_version171    util_set_arch 'i686-darwin8'172    x86_darwin = Gem::Platform.new ['x86', 'darwin', nil]173    x86_darwin7 = Gem::Platform.new ['x86', 'darwin', '7']174    x86_darwin8 = Gem::Platform.new ['x86', 'darwin', '8']175    x86_darwin9 = Gem::Platform.new ['x86', 'darwin', '9']176    assert((x86_darwin  === Gem::Platform.local), 'x86_darwin === x86_darwin8')177    assert((x86_darwin8 === Gem::Platform.local), 'x86_darwin8 === x86_darwin8')178    refute((x86_darwin7 === Gem::Platform.local), 'x86_darwin7 === x86_darwin8')179    refute((x86_darwin9 === Gem::Platform.local), 'x86_darwin9 === x86_darwin8')180  end181  def test_equals_tilde182    util_set_arch 'i386-mswin32'183    assert_local_match 'mswin32'184    assert_local_match 'i386-mswin32'185    # oddballs186    assert_local_match 'i386-mswin32-mq5.3'187    assert_local_match 'i386-mswin32-mq6'188    refute_local_match 'win32-1.8.2-VC7'189    refute_local_match 'win32-1.8.4-VC6'190    refute_local_match 'win32-source'191    refute_local_match 'windows'192    util_set_arch 'i686-linux'193    assert_local_match 'i486-linux'194    assert_local_match 'i586-linux'195    assert_local_match 'i686-linux'196    util_set_arch 'i686-darwin8'197    assert_local_match 'i686-darwin8.4.1'198    assert_local_match 'i686-darwin8.8.2'199    util_set_arch 'java'200    assert_local_match 'java'201    assert_local_match 'jruby'202    util_set_arch 'universal-dotnet2.0'203    assert_local_match 'universal-dotnet'204    assert_local_match 'universal-dotnet-2.0'205    refute_local_match 'universal-dotnet-4.0'206    assert_local_match 'dotnet'207    assert_local_match 'dotnet-2.0'208    refute_local_match 'dotnet-4.0'209    util_set_arch 'universal-dotnet4.0'...

Full Screen

Full Screen

android.rake

Source:android.rake Github

copy

Full Screen

...38  end39  def bin_gcc(command)40    command = command.to_s41    command = case arch42      when /armeabi/    then 'arm-linux-androideabi-'43      when /arm64-v8a/  then 'aarch64-linux-android-'44      when /x86_64/     then 'x86_64-linux-android-'45      when /x86/        then 'i686-linux-android-'46      when /mips64/     then 'mips64el-linux-android-'47      when /mips/       then 'mipsel-linux-android-'48      end + command49    gcc_toolchain_path.join('bin', command).to_s50  end51  def bin(command)52    command = command.to_s53    toolchain_path.join('bin', command).to_s54  end55  def home_path56    @home_path ||= Pathname(57      params[:ndk_home] ||58      ENV['ANDROID_NDK_HOME'] ||59      DEFAULT_NDK_HOMES.find { |path|60        path.gsub! '%LOCALAPPDATA%', ENV['LOCALAPPDATA'] || '%LOCALAPPDATA%'61        path.gsub! '\\', '/'62        path.gsub! '~', Dir.home || '~'63        File.directory?(path)64      } || raise(AndroidNDKHomeNotFound)65    )66  end67  def toolchain68    @toolchain ||= params.fetch(:toolchain){ DEFAULT_TOOLCHAIN }69  end70  def toolchain_path71    @toolchain_path ||= case toolchain72      when :gcc73        gcc_toolchain_path74      when :clang75        home_path.join('toolchains', 'llvm' , 'prebuilt', host_platform)76      end77  end78  def gcc_toolchain_path79    if @gcc_toolchain_path === nil then80      prefix = case arch81        when /armeabi/    then 'arm-linux-androideabi-'82        when /arm64-v8a/  then 'aarch64-linux-android-'83        when /x86_64/     then 'x86_64-'84        when /x86/        then 'x86-'85        when /mips64/     then 'mips64el-linux-android-'86        when /mips/       then 'mipsel-linux-android-'87        end88      test = case arch89        when /armeabi/    then 'arm-linux-androideabi-*'90        when /arm64-v8a/  then 'aarch64-linux-android-*'91        when /x86_64/     then 'x86_64-*'92        when /x86/        then 'x86-*'93        when /mips64/     then 'mips64el-linux-android-*'94        when /mips/       then 'mipsel-linux-android-*'95        end96      gcc_toolchain_version = Dir[home_path.join('toolchains', test)].map{|t| t.match(/-(\d+\.\d+)$/); $1.to_f }.max97      @gcc_toolchain_path = home_path.join('toolchains', prefix + gcc_toolchain_version.to_s, 'prebuilt', host_platform)98    end99    @gcc_toolchain_path100  end101  def host_platform102    @host_platform ||= case RUBY_PLATFORM103      when /cygwin|mswin|mingw|bccwin|wince|emx/i104        path = home_path.join('toolchains', 'llvm' , 'prebuilt', 'windows*')105        Dir.glob(path.to_s){ |item|106          next if File.file?(item)107          path = Pathname(item)108          break109        }110        path.basename111      when /x86_64-darwin/i112        'darwin-x86_64'113      when /darwin/i114        'darwin-x86'115      when /x86_64-linux/i116        'linux-x86_64'117      when /linux/i118        'linux-x86'119      else120        raise NotImplementedError, "Unknown host platform (#{RUBY_PLATFORM})"121      end122  end123  def arch124    @arch ||= (params[:arch] || ENV['ANDROID_ARCH'] || DEFAULT_ARCH).to_s125  end126  def sysroot127    @sysroot ||= home_path.join('platforms', platform,128        case arch129        when /armeabi/    then 'arch-arm'130        when /arm64-v8a/  then 'arch-arm64'131        when /x86_64/     then 'arch-x86_64'132        when /x86/        then 'arch-x86'133        when /mips64/     then 'arch-mips64'134        when /mips/       then 'arch-mips'135        end136      ).to_s137  end138  def platform139    if @platform === nil then140      @platform = params[:platform] || ENV['ANDROID_PLATFORM'] || nil141      if @platform === nil142        Dir.glob(home_path.join('platforms/android-*').to_s){ |item|143          next if File.file?(item)144          if @platform === nil145            @platform = Integer(item.rpartition('-')[2])146          else147            platform = Integer(item.rpartition('-')[2])148            @platform = platform > @platform ? platform : @platform149          end150        }151        if @platform === nil152          raise(PlatformDirNotFound)153        else154          @platform = "android-#{@platform}"155        end156      end157    end158    if Integer(@platform.rpartition('-')[2]) < 21159      case arch160      when /arm64-v8a/, /x86_64/, /mips64/161        raise NotImplementedError, "Platform (#{@platform}) has no implementation for architecture (#{arch})"162      end163    end164    @platform165  end166  def armeabi_v7a_mfpu167    @armeabi_v7a_mfpu ||= (params[:mfpu] || 'vfpv3-d16').to_s168  end169  def armeabi_v7a_mfloat_abi170    @armeabi_v7a_mfloat_abi ||= (params[:mfloat_abi] || 'softfp').to_s171  end172  def no_warn_mismatch173    if %W(soft softfp).include? armeabi_v7a_mfloat_abi174      ''175    else176      ',--no-warn-mismatch'177    end178  end179  def cc180    case toolchain181    when :gcc then bin_gcc('gcc')182    when :clang then bin('clang')183    end184  end185  def ar186    case toolchain187    when :gcc   then bin_gcc('ar')188    when :clang then bin_gcc('ar')189    end190  end191  def ctarget192    flags = []193    case toolchain194    when :gcc195      case arch196      when /armeabi-v7a/  then flags += %W(-march=armv7-a)197      when /armeabi/      then flags += %W(-march=armv5te)198      when /arm64-v8a/    then flags += %W(-march=armv8-a)199      when /x86_64/       then flags += %W(-march=x86-64)200      when /x86/          then flags += %W(-march=i686)201      when /mips64/       then flags += %W(-march=mips64r6)202      when /mips/         then flags += %W(-march=mips32)203      end204    when :clang205      case arch206      when /armeabi-v7a/  then flags += %W(-target armv7-none-linux-androideabi)207      when /armeabi/      then flags += %W(-target armv5te-none-linux-androideabi)208      when /arm64-v8a/    then flags += %W(-target aarch64-none-linux-android)209      when /x86_64/       then flags += %W(-target x86_64-none-linux-android)210      when /x86/          then flags += %W(-target i686-none-linux-android)211      when /mips64/       then flags += %W(-target mips64el-none-linux-android)212      when /mips/         then flags += %W(-target mipsel-none-linux-android)213      end214    end215    case arch216    when /armeabi-v7a/  then flags += %W(-mfpu=#{armeabi_v7a_mfpu} -mfloat-abi=#{armeabi_v7a_mfloat_abi})217    when /armeabi/      then flags += %W(-mtune=xscale -msoft-float)218    when /arm64-v8a/    then flags += %W()219    when /x86_64/       then flags += %W()220    when /x86/          then flags += %W()221    when /mips64/       then flags += %W(-fmessage-length=0)222    when /mips/         then flags += %W(-fmessage-length=0)223    end224    flags225  end226  def cflags227    flags = []228    flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}")229    flags += ctarget230    case toolchain231    when :gcc232    when :clang233      flags += %W(-gcc-toolchain "#{gcc_toolchain_path}" -Wno-invalid-command-line-argument -Wno-unused-command-line-argument)234    end235    flags += %W(-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes)236    flags237  end238  def ldflags239    flags = []240    flags += %W(--sysroot="#{sysroot}")241    flags242  end243  def ldflags_before_libraries244    flags = []245    case toolchain246    when :gcc247      case arch248      when /armeabi-v7a/  then flags += %W(-Wl#{no_warn_mismatch})249      end250    when :clang251      flags += %W(-gcc-toolchain "#{gcc_toolchain_path.to_s}")252      case arch253      when /armeabi-v7a/  then flags += %W(-target armv7-none-linux-androideabi -Wl,--fix-cortex-a8#{no_warn_mismatch})254      when /armeabi/      then flags += %W(-target armv5te-none-linux-androideabi)255      when /arm64-v8a/    then flags += %W(-target aarch64-none-linux-android)256      when /x86_64/       then flags += %W(-target x86_64-none-linux-android)257      when /x86/          then flags += %W(-target i686-none-linux-android)258      when /mips64/       then flags += %W(-target mips64el-none-linux-android)259      when /mips/         then flags += %W(-target mipsel-none-linux-android)260      end261    end262    flags += %W(-no-canonical-prefixes)263    flags264  end265end266MRuby::Toolchain.new(:android) do |conf, params|267  android = MRuby::Toolchain::Android.new(params)268  toolchain android.toolchain269  [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|270    cc.command = android.cc271    cc.flags = android.cflags272  end273  conf.archiver.command = android.ar...

Full Screen

Full Screen

os_common_test.rb

Source:os_common_test.rb Github

copy

Full Screen

...26    let(:os) { mock_platform('redhat') }27    it { os.redhat?.must_equal(true) }28    it { os.debian?.must_equal(false) }29    it { os.suse?.must_equal(false) }30    it { os.linux?.must_equal(true) }31    it { os.unix?.must_equal(true) }32  end33  describe 'with platform set to oracle' do34    let(:os) { mock_platform('oracle') }35    it { os.redhat?.must_equal(true) }36    it { os.debian?.must_equal(false) }37    it { os.suse?.must_equal(false) }38    it { os.linux?.must_equal(true) }39    it { os.unix?.must_equal(true) }40  end41  describe 'with platform set to centos' do42    let(:os) { mock_platform('centos') }43    it { os.redhat?.must_equal(true) }44    it { os.debian?.must_equal(false) }45    it { os.suse?.must_equal(false) }46    it { os.linux?.must_equal(true) }47    it { os.unix?.must_equal(true) }48  end49  describe 'with platform set to fedora' do50    let(:os) { mock_platform('fedora') }51    it { os.redhat?.must_equal(true) }52    it { os.debian?.must_equal(false) }53    it { os.suse?.must_equal(false) }54    it { os.linux?.must_equal(true) }55    it { os.unix?.must_equal(true) }56  end57  describe 'with platform set to debian' do58    let(:os) { mock_platform('debian') }59    it { os.redhat?.must_equal(false) }60    it { os.debian?.must_equal(true) }61    it { os.suse?.must_equal(false) }62    it { os.linux?.must_equal(true) }63    it { os.unix?.must_equal(true) }64  end65  describe 'with platform set to ubuntu' do66    let(:os) { mock_platform('ubuntu') }67    it { os.redhat?.must_equal(false) }68    it { os.debian?.must_equal(true) }69    it { os.suse?.must_equal(false) }70    it { os.linux?.must_equal(true) }71    it { os.unix?.must_equal(true) }72  end73  describe 'with platform set to linuxmint' do74    let(:os) { mock_platform('linuxmint') }75    it { os.redhat?.must_equal(false) }76    it { os.debian?.must_equal(true) }77    it { os.suse?.must_equal(false) }78    it { os.linux?.must_equal(true) }79    it { os.unix?.must_equal(true) }80  end81  describe 'with platform set to raspbian' do82    let(:os) { mock_platform('raspbian') }83    it { os.redhat?.must_equal(false) }84    it { os.debian?.must_equal(true) }85    it { os.suse?.must_equal(false) }86    it { os.linux?.must_equal(true) }87    it { os.unix?.must_equal(true) }88  end89  describe 'with platform set to suse' do90    let(:os) { mock_platform('suse') }91    it { os.redhat?.must_equal(false) }92    it { os.debian?.must_equal(false) }93    it { os.suse?.must_equal(true) }94    it { os.linux?.must_equal(true) }95    it { os.unix?.must_equal(true) }96  end97  describe 'with platform set to opensuse' do98    let(:os) { mock_platform('opensuse') }99    it { os.redhat?.must_equal(false) }100    it { os.debian?.must_equal(false) }101    it { os.suse?.must_equal(true) }102    it { os.linux?.must_equal(true) }103    it { os.unix?.must_equal(true) }104  end105  describe 'with platform set to alpine' do106    let(:os) { mock_platform('alpine') }107    it { os.redhat?.must_equal(false) }108    it { os.debian?.must_equal(false) }109    it { os.suse?.must_equal(false) }110    it { os.linux?.must_equal(true) }111    it { os.unix?.must_equal(true) }112  end113  describe 'with platform set to arch' do114    let(:os) { mock_platform('arch') }115    it { os.redhat?.must_equal(false) }116    it { os.debian?.must_equal(false) }117    it { os.suse?.must_equal(false) }118    it { os.linux?.must_equal(true) }119    it { os.unix?.must_equal(true) }120  end121  describe 'with platform set to coreos' do122    let(:os) { mock_platform('coreos') }123    it { os.redhat?.must_equal(false) }124    it { os.debian?.must_equal(false) }125    it { os.suse?.must_equal(false) }126    it { os.linux?.must_equal(true) }127    it { os.unix?.must_equal(true) }128  end129  describe 'with platform set to exherbo' do130    let(:os) { mock_platform('exherbo') }131    it { os.redhat?.must_equal(false) }132    it { os.debian?.must_equal(false) }133    it { os.suse?.must_equal(false) }134    it { os.linux?.must_equal(true) }135    it { os.unix?.must_equal(true) }136  end137  describe 'with platform set to gentoo' do138    let(:os) { mock_platform('gentoo') }139    it { os.redhat?.must_equal(false) }140    it { os.debian?.must_equal(false) }141    it { os.suse?.must_equal(false) }142    it { os.linux?.must_equal(true) }143    it { os.unix?.must_equal(true) }144  end145  describe 'with platform set to slackware' do146    let(:os) { mock_platform('slackware') }147    it { os.redhat?.must_equal(false) }148    it { os.debian?.must_equal(false) }149    it { os.suse?.must_equal(false) }150    it { os.linux?.must_equal(true) }151    it { os.unix?.must_equal(true) }152  end153  describe 'with platform set to wrlinux' do154    let(:os) { mock_platform('wrlinux') }155    it { os.redhat?.must_equal(true) }156    it { os.debian?.must_equal(false) }157    it { os.suse?.must_equal(false) }158    it { os.linux?.must_equal(true) }159    it { os.unix?.must_equal(true) }160  end161  describe 'with platform set to linux' do162    let(:os) { mock_platform('linux') }163    it { os.linux?.must_equal(true) }164    it { os.unix?.must_equal(true) }165  end166  describe 'with platform set to freebsd' do167    let(:os) { mock_platform('freebsd') }168    it { os.bsd?.must_equal(true) }169    it { os.linux?.must_equal(false) }170    it { os.unix?.must_equal(true) }171  end172  describe 'with platform set to netbsd' do173    let(:os) { mock_platform('netbsd') }174    it { os.bsd?.must_equal(true) }175    it { os.linux?.must_equal(false) }176    it { os.unix?.must_equal(true) }177  end178  describe 'with platform set to openbsd' do179    let(:os) { mock_platform('openbsd') }180    it { os.bsd?.must_equal(true) }181    it { os.linux?.must_equal(false) }182    it { os.unix?.must_equal(true) }183  end184  describe 'with platform set to darwin' do185    let(:os) { mock_platform('darwin') }186    it { os.bsd?.must_equal(true) }187    it { os.linux?.must_equal(false) }188    it { os.unix?.must_equal(true) }189  end190  describe 'with platform set to solaris' do191    let(:os) { mock_platform('solaris') }192    it { os.solaris?.must_equal(true) }193    it { os.linux?.must_equal(false) }194    it { os.unix?.must_equal(true) }195  end196  describe 'with platform set to smartos' do197    let(:os) { mock_platform('smartos') }198    it { os.solaris?.must_equal(true) }199    it { os.linux?.must_equal(false) }200    it { os.unix?.must_equal(true) }201  end202  describe 'with platform set to openindiana' do203    let(:os) { mock_platform('openindiana') }204    it { os.solaris?.must_equal(true) }205    it { os.linux?.must_equal(false) }206    it { os.unix?.must_equal(true) }207  end208  describe 'with platform set to opensolaris' do209    let(:os) { mock_platform('opensolaris') }210    it { os.solaris?.must_equal(true) }211    it { os.linux?.must_equal(false) }212    it { os.unix?.must_equal(true) }213  end214  describe 'with platform set to nexentacore' do215    let(:os) { mock_platform('nexentacore') }216    it { os.solaris?.must_equal(true) }217    it { os.linux?.must_equal(false) }218    it { os.unix?.must_equal(true) }219  end220  describe 'with platform set to windows' do221    let(:os) { mock_platform('windows') }222    it { os.solaris?.must_equal(false) }223    it { os.bsd?.must_equal(false) }224    it { os.linux?.must_equal(false) }225    it { os.unix?.must_equal(false) }226  end227  describe 'with platform set to hpux' do228    let(:os) { mock_platform('hpux') }229    it { os.solaris?.must_equal(false) }230    it { os.linux?.must_equal(false) }231    it { os.unix?.must_equal(true) }232    it { os.hpux?.must_equal(true) }233  end234  describe 'with platform set to esx' do235    let(:os) { mock_platform('esx') }236    it { os.solaris?.must_equal(false) }237    it { os.linux?.must_equal(false) }238    it { os.unix?.must_equal(false) }239    it { os.esx?.must_equal(true) }240  end241end...

Full Screen

Full Screen

VolMgrPlatformSupportLinux.rb

Source:VolMgrPlatformSupportLinux.rb Github

copy

Full Screen

1require 'util/miq-password'2require 'VMwareWebService/MiqVim'3module VolMgrPlatformSupportLinux4  def init5    $log.debug "Initializing VolMgrPlatformSupportLinux: #{@cfgFile}" if $log.debug?6    @ems = nil7    @snMor = nil8    @vi = nil9    @vimVm = nil10    return if $miqHostCfg.nil?11    $log.debug "VolMgrPlatformSupportLinux: $miqHostCfg.forceFleeceDefault = #{$miqHostCfg.forceFleeceDefault}" if $log.debug?12    @ost.force = $miqHostCfg.forceFleeceDefault if @ost.force.nil?13    unless @ost.force14      $log.info "Initializing VolMgrPlatformSupportLinux: force flag = false" if $log15      return  # Remove this if setDiskFlags is reactivated16    end17    if @ost.miqVimVm18      @vimVm = @ost.miqVimVm19      return20    end21    unless $miqHostCfg.emsLocal22      $log.warn "VolMgrPlatformSupportLinux: emslocal not set"23      return24    end25    if File.extname(@cfgFile) != ".vmx"26      $log.warn "VolMgrPlatformSupportLinux: @cfgFile is not a vmx file"27      return28    end29    $log.debug "VolMgrPlatformSupportLinux::init: emsLocal = #{$miqHostCfg.emsLocal}" if $log.debug?30    @ems = $miqHostCfg.ems[$miqHostCfg.emsLocal]31    @vi = MiqVim.new(@ems['host'], @ems['user'], MiqPassword.decrypt(@ems['password']))32    begin33      @vimVm = @vi.getVimVm(@cfgFile)34    rescue => err35      $log.debug "VolMgrPlatformSupportLinux::init: could not get MiqVimVm object for: #{@cfgFile}" if $log.debug?36      @vimVm = nil37    end38  end39  #40  # No longer used.41  #42  def setDiskFlags(dInfo)43    unless @vimVm44      $log.debug "VolMgrPlatformSupportLinux::setDiskFlags: vimVm not set, setting baseOnly = false" if $log.debug?45      return46    end47    if @ost.force48      $log.debug "VolMgrPlatformSupportLinux::setDiskFlags: force flag = true, setting baseOnly = false" if $log.debug?49      return50    end51    unless (si = @vimVm.snapshotInfo)52      $log.debug "VolMgrPlatformSupportLinux::setDiskFlags: VM has no snapshot information, setting baseOnly = false" if $log.debug?53      return54    end55    ssHash = si['ssMorHash']56    sn = ssHash[si['currentSnapshot'].to_s]['name']57    $log.debug "VolMgrPlatformSupportLinux::setDiskFlags: current snapshot name = #{sn}" if $log.debug?58    if sn == "EvmSnapshot"59      $log.debug "VolMgrPlatformSupportLinux::setDiskFlags: setting baseOnly = true" if $log.debug?60      dInfo.baseOnly = true61    end62  end63  def preMount64    $log.debug "VolMgrPlatformSupportLinux.preMount called" if $log.debug?65    return unless @ost.force66    if @snMor67      $log.error "VolMgrPlatformSupportLinux::preMount - #{@cfgFile} is already mounted"68      return69    end70    unless @vimVm71      $log.warn "VolMgrPlatformSupportLinux::preMount: cannot snapshot VM not registered to this host: #{@cfgFile}"72      return73    end74    desc = @ost.snapshotDescription ? @ost.snapshotDescription : "EVM Snapshot"75    st = Time.now76    @snMor = @vimVm.createEvmSnapshot(desc, "false", true, @ost.snapshot_create_free_space)77    $log.info "VM snapshot created in [#{Time.now - st}] seconds"78    $log.debug "VolMgrPlatformSupportLinux::preMount: snMor = \"#{@snMor}\"" if $log.debug?79  end80  def postMount81    $log.debug "VolMgrPlatformSupportLinux.postMount called" if $log.debug?82    return unless @ost.force83    return unless @vimVm84    if @ost.force85      if !@snMor86        $log.warn "VolMgrPlatformSupportLinux::postMount: VM not snapped: #{@cfgFile}"87      else88        $log.debug "VolMgrPlatformSupportLinux::postMount: removing snapshot snMor = \"#{@snMor}\"" if $log.debug?89        begin90          @vimVm.removeSnapshot(@snMor, "false", true, @ost.snapshot_remove_free_space)91        rescue => err92          $log.warn "VolMgrPlatformSupportLinux::postMount: failed to remove snapshot for VM: #{@cfgFile}"93          $log.warn "VolMgrPlatformSupportLinux::postMount: #{err}"94        end95      end96    end97    #98    # If we opened the vimVm (it wasn't passed into us)99    # then release it.100    #101    @vimVm.release unless @ost.miqVimVm102    @vimVm = nil103    @vi.disconnect if @vi104    @vi = nil105    @snMor = nil106  end107end # module VolMgrPlatformSupportLinux...

Full Screen

Full Screen

ffi-1.1.3.gemspec

Source:ffi-1.1.3.gemspec Github

copy

Full Screen

...7  s.date = "2012-07-30"8  s.description = "Ruby-FFI is a ruby extension for programmatically loading dynamic\nlibraries, binding functions within them, and calling those functions\nfrom Ruby code. Moreover, a Ruby-FFI extension works without changes\non Ruby and JRuby. Discover why should you write your next extension\nusing Ruby-FFI here[http://wiki.github.com/ffi/ffi/why-use-ffi]."9  s.email = "wmeissner@gmail.com"10  s.extensions = ["ext/ffi_c/extconf.rb"]11  s.extra_rdoc_files = ["History.txt", "README.rdoc", "lib/ffi/platform/arm-linux/types.conf", "lib/ffi/platform/i386-darwin/types.conf", "lib/ffi/platform/i386-freebsd/types.conf", "lib/ffi/platform/i386-linux/types.conf", "lib/ffi/platform/i386-netbsd/types.conf", "lib/ffi/platform/i386-openbsd/types.conf", "lib/ffi/platform/i386-solaris/types.conf", "lib/ffi/platform/i386-windows/types.conf", "lib/ffi/platform/i486-gnu/types.conf", "lib/ffi/platform/ia64-linux/types.conf", "lib/ffi/platform/mips-linux/types.conf", "lib/ffi/platform/mipsel-linux/types.conf", "lib/ffi/platform/powerpc-aix/types.conf", "lib/ffi/platform/powerpc-darwin/types.conf", "lib/ffi/platform/powerpc-linux/types.conf", "lib/ffi/platform/s390-linux/types.conf", "lib/ffi/platform/s390x-linux/types.conf", "lib/ffi/platform/sparc-linux/types.conf", "lib/ffi/platform/sparc-solaris/types.conf", "lib/ffi/platform/sparcv9-solaris/types.conf", "lib/ffi/platform/x86_64-darwin/types.conf", "lib/ffi/platform/x86_64-freebsd/types.conf", "lib/ffi/platform/x86_64-linux/types.conf", "lib/ffi/platform/x86_64-netbsd/types.conf", "lib/ffi/platform/x86_64-openbsd/types.conf", "lib/ffi/platform/x86_64-solaris/types.conf", "lib/Lib.iml"]12  s.files = ["History.txt", "README.rdoc", "lib/ffi/platform/arm-linux/types.conf", "lib/ffi/platform/i386-darwin/types.conf", "lib/ffi/platform/i386-freebsd/types.conf", "lib/ffi/platform/i386-linux/types.conf", "lib/ffi/platform/i386-netbsd/types.conf", "lib/ffi/platform/i386-openbsd/types.conf", "lib/ffi/platform/i386-solaris/types.conf", "lib/ffi/platform/i386-windows/types.conf", "lib/ffi/platform/i486-gnu/types.conf", "lib/ffi/platform/ia64-linux/types.conf", "lib/ffi/platform/mips-linux/types.conf", "lib/ffi/platform/mipsel-linux/types.conf", "lib/ffi/platform/powerpc-aix/types.conf", "lib/ffi/platform/powerpc-darwin/types.conf", "lib/ffi/platform/powerpc-linux/types.conf", "lib/ffi/platform/s390-linux/types.conf", "lib/ffi/platform/s390x-linux/types.conf", "lib/ffi/platform/sparc-linux/types.conf", "lib/ffi/platform/sparc-solaris/types.conf", "lib/ffi/platform/sparcv9-solaris/types.conf", "lib/ffi/platform/x86_64-darwin/types.conf", "lib/ffi/platform/x86_64-freebsd/types.conf", "lib/ffi/platform/x86_64-linux/types.conf", "lib/ffi/platform/x86_64-netbsd/types.conf", "lib/ffi/platform/x86_64-openbsd/types.conf", "lib/ffi/platform/x86_64-solaris/types.conf", "lib/Lib.iml", "ext/ffi_c/extconf.rb"]13  s.homepage = "http://wiki.github.com/ffi/ffi"14  s.rdoc_options = ["-x", "ext", "--main", "README.rdoc"]15  s.require_paths = ["lib", "ext"]16  s.rubyforge_project = "ffi"17  s.rubygems_version = "1.8.24"18  s.summary = "Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code"19  if s.respond_to? :specification_version then20    s.specification_version = 321    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then22    else23    end24  else25  end26end...

Full Screen

Full Screen

linux.rb

Source:linux.rb Github

copy

Full Screen

...8# the License for the specific language governing permissions and9# limitations under the License.10#------------------------------------------------------------------------------11require 'ec2/platform/base'12require 'ec2/platform/linux/identity'13require 'ec2/platform/linux/architecture'14require 'ec2/platform/linux/fstab'15require 'ec2/platform/linux/mtab'16require 'ec2/platform/linux/image'17require 'ec2/platform/linux/rsync'18require 'ec2/platform/linux/tar'19require 'ec2/platform/linux/uname'20require 'ec2/platform/linux/pipeline'21require 'ec2/platform/linux/constants'22module EC223  module Platform    24    module Linux25      module Distribution26        include EC2::Platform::Base::Distribution27        AMAZON    = 'Amazon Linux'28        REDHAT    = 'Red Hat Linux'29        GENTOO    = 'Gentoo'30        DEBIAN    = 'Debian'31        UBUNTU    = 'Ubuntu'32        FEDORA    = 'Fedora'33        SLACKWARE = 'Slackware'34        SUSE      = 'SuSE Linux'35        MANDRAKE  = 'Mandrake'...

Full Screen

Full Screen

platform_spec.rb

Source:platform_spec.rb Github

copy

Full Screen

...4#5require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))6describe "FFI::Platform::LIBSUFFIX" do7  case OS8  when "linux"9    it "returns 'so'" do10      expect(FFI::Platform::LIBSUFFIX).to eq('so')11    end12  when "windows"13    it "returns 'dll'" do14      expect(FFI::Platform::LIBSUFFIX).to eq('dll')15    end16  when "darwin"17    it "returns 'dylib'" do18      expect(FFI::Platform::LIBSUFFIX).to eq('dylib')19    end20  end21end22describe "FFI::Platform::IS_WINDOWS" do23  case OS24  when "linux"25    it "returns false" do26      expect(FFI::Platform::IS_WINDOWS).to be false27    end28  when "windows"29    it "returns true" do30      expect(FFI::Platform::IS_WINDOWS).to be true31    end32  when "darwin"33    it "returns false" do34      expect(FFI::Platform::IS_WINDOWS).to be false35    end36  end37end38describe "FFI::Platform::ARCH" do39  it "returns the architecture type" do40    expect(FFI::Platform::ARCH).to eq(CPU)41  end42end43describe "FFI::Platform::OS" do44  case OS45  when "linux"46    it "returns 'linux' as a string" do47      expect(FFI::Platform::OS).to eq('linux')48    end49  when "windows"50    it "returns 'windows' as a string" do51      expect(FFI::Platform::OS).to eq('windows')52    end53  when "darwin"54    it "returns 'darwin' as a string" do55      expect(FFI::Platform::OS).to eq('darwin')56    end57  end58end59describe "FFI::Platform.windows?" do60  case OS61  when "linux"62    it "returns false" do63      expect(FFI::Platform.windows?).to be false64    end65  when "windows"66    it "returns true" do67      expect(FFI::Platform.windows?).to be true68    end69  when "darwin"70    it "returns false" do71      expect(FFI::Platform.windows?).to be false72    end73  end74end75describe "FFI::Platform.mac?" do76  case OS77  when "linux"78    it "returns false" do79      expect(FFI::Platform.mac?).to be false80    end81  when "windows"82    it "returns false" do83      expect(FFI::Platform.mac?).to be false84    end85  when "darwin"86    it "returns true" do87      expect(FFI::Platform.mac?).to be true88    end89  end90end91describe "FFI::Platform.unix?" do92  case OS93  when "linux"94    it "returns true" do95      expect(FFI::Platform.unix?).to be true96    end97  when "windows"98    it "returns false" do99      expect(FFI::Platform.unix?).to be false100    end101  when "darwin"102    it "returns true" do103      expect(FFI::Platform.unix?).to be true104    end105  end106end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful