/
cpp_spec.rb
75 lines (59 loc) · 1.85 KB
/
cpp_spec.rb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require 'spec_helper'
describe Travis::Build::Script::Cpp do
let(:config) { PAYLOADS[:push].deep_clone }
subject { described_class.new(config).compile }
before :each do
executable 'configure'
end
it_behaves_like 'a build script'
it 'sets CXX to g++ if gcc given as compiler' do
config['config']['compiler'] = 'gcc'
should set 'CXX', 'g++'
end
it 'sets CXX to g++ if g++ given as compiler' do
config['config']['compiler'] = 'g++'
should set 'CXX', 'g++'
end
it 'sets CXX to clang if clang given as compiler' do
config['config']['compiler'] = 'clang'
should set 'CXX', 'clang'
end
it 'sets CXX to clang if clang++ given as compiler' do
config['config']['compiler'] = 'clang++'
should set 'CXX', 'clang'
end
it 'sets CXX to g++ by default' do
config['config']['compiler'] = 'compiler'
should set 'CXX', 'g++'
end
it 'sets CC to gcc if gcc given as compiler' do
config['config']['compiler'] = 'gcc'
should set 'CC', 'gcc'
end
it 'sets CC to gcc if g++ given as compiler' do
config['config']['compiler'] = 'g++'
should set 'CC', 'gcc'
end
it 'sets CC to clang if clang given as compiler' do
config['config']['compiler'] = 'clang'
should set 'CC', 'clang'
end
it 'sets CC to clang if clang++ given as compiler' do
config['config']['compiler'] = 'clang++'
should set 'CC', 'clang'
end
it 'sets CC to gcc by default' do
config['config']['compiler'] = 'compiler'
should set 'CC', 'gcc'
end
it 'runs gcc --version' do
config['config']['compiler'] = 'gcc'
should announce 'gcc --version'
end
it 'runs ./configure && make && make test' do
should run 'echo $ ./configure && make && make test'
should run 'configure', log: true
should run 'make', log: true
should run 'make test', log: true, timeout: timeout_for(:script)
end
end