require 'formula' class Libdca < Formula homepage 'http://www.videolan.org/developers/libdca.html' url 'http://download.videolan.org/pub/videolan/libdca/0.0.5/libdca-0.0.5.tar.bz2' sha1 '3fa5188eaaa2fc83fb9c4196f6695a23cb17f3bc' def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make" system "make install" end end ble id='header'> cgit logo index : brew
🍺 The missing package manager for macOS
aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/test.rb
blob: 0983c0b815ad4993b7acccd6fe13350cd50cb894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require "extend/ENV"
require "timeout"
require "debrew"
require "formula_assertions"

module Homebrew
  TEST_TIMEOUT_SECONDS = 5*60

  def test
    raise FormulaUnspecifiedError if ARGV.named.empty?

    ENV.extend(Stdenv)
    ENV.setup_build_environment

    ARGV.formulae.each do |f|
      # Cannot test uninstalled formulae
      unless f.installed?
        ofail "Testing requires the latest version of #{f.name}"
        next
      end

      # Cannot test formulae without a test method
      unless f.test_defined?
        ofail "#{f.name} defines no test"
        next
      end

      puts "Testing #{f.name}"

      f.extend(Assertions)
      f.extend(Debrew::Formula) if ARGV.debug?

      env = ENV.to_hash

      begin
        # tests can also return false to indicate failure
        Timeout::timeout TEST_TIMEOUT_SECONDS do
          raise "test returned false" if f.run_test == false
        end
      rescue Assertions::FailedAssertion => e
        ofail "#{f.name}: failed"
        puts e.message
      rescue Exception => e
        ofail "#{f.name}: failed"
        puts e, e.backtrace
      ensure
        ENV.replace(env)
      end
    end
  end
end