Fix up some configure tests
This commit is contained in:
parent
7189a04299
commit
679c013eaa
@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
check_c_compiler "nope.nope"
|
check_c_compiler "nope.nope"
|
||||||
end
|
end
|
||||||
|
default
|
||||||
|
@ -1 +0,0 @@
|
|||||||
autoconf false
|
|
@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
check_c_compiler
|
check_c_compiler
|
||||||
end
|
end
|
||||||
|
default
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
Environment.new do |env|
|
|
||||||
env.Object("simple.o", "simple.cc")
|
|
||||||
end
|
|
@ -41,22 +41,15 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @param tasks [Array<String>]
|
# @param tasks [Array<String>]
|
||||||
# List of task(s) to execute.
|
# List of task(s) to execute.
|
||||||
# @param options [Hash]
|
|
||||||
# Optional parameters.
|
|
||||||
#
|
#
|
||||||
# @return [Integer]
|
# @return [Integer]
|
||||||
# Process exit code (0 on success).
|
# Process exit code (0 on success).
|
||||||
def run(tasks, options = {})
|
def run(tasks)
|
||||||
Cache.instance["failed_commands"] = []
|
Cache.instance["failed_commands"] = []
|
||||||
begin
|
tasks.each do |task|
|
||||||
tasks.each do |task|
|
Task[task].check_execute
|
||||||
Task[task].check_execute
|
|
||||||
end
|
|
||||||
0
|
|
||||||
rescue RsconsError => e
|
|
||||||
Ansi.write($stderr, :red, e.message, :reset, "\n")
|
|
||||||
1
|
|
||||||
end
|
end
|
||||||
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Show the last failures.
|
# Show the last failures.
|
||||||
|
@ -118,39 +118,44 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Load the build script.
|
begin
|
||||||
if rsconscript
|
# Load the build script.
|
||||||
Rscons.application.script.load(rsconscript)
|
if rsconscript
|
||||||
|
Rscons.application.script.load(rsconscript)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Do help after loading the build script (if found) so that any
|
||||||
|
# script-defined tasks and task options can be displayed.
|
||||||
|
if do_help
|
||||||
|
puts usage
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Anything else requires a build script, so complain if we didn't find
|
||||||
|
# one.
|
||||||
|
unless rsconscript
|
||||||
|
$stderr.puts "Could not find the Rsconscript to execute."
|
||||||
|
$stderr.puts "Looked for: #{DEFAULT_RSCONSCRIPTS.join(", ")}"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Parse the rest of the command line. This is done after loading the
|
||||||
|
# build script so that script-defined tasks and task options can be
|
||||||
|
# taken into account.
|
||||||
|
tasks = parse_tasks_and_params(argv)
|
||||||
|
|
||||||
|
# If no user specified tasks, run "default" task.
|
||||||
|
if tasks.empty?
|
||||||
|
tasks << "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finally, with the script fully loaded and command-line parsed, run
|
||||||
|
# the application to execute all required tasks.
|
||||||
|
Rscons.application.run(tasks)
|
||||||
|
rescue RsconsError => e
|
||||||
|
Ansi.write($stderr, :red, e.message, :reset, "\n")
|
||||||
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Do help after loading the build script (if found) so that any
|
|
||||||
# script-defined tasks and task options can be displayed.
|
|
||||||
if do_help
|
|
||||||
puts usage
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# Anything else requires a build script, so complain if we didn't find
|
|
||||||
# one.
|
|
||||||
unless rsconscript
|
|
||||||
$stderr.puts "Could not find the Rsconscript to execute."
|
|
||||||
$stderr.puts "Looked for: #{DEFAULT_RSCONSCRIPTS.join(", ")}"
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
# Parse the rest of the command line. This is done after loading the
|
|
||||||
# build script so that script-defined tasks and task options can be
|
|
||||||
# taken into account.
|
|
||||||
tasks = parse_tasks_and_params(argv)
|
|
||||||
|
|
||||||
# If no user specified tasks, run "default" task.
|
|
||||||
if tasks.empty?
|
|
||||||
tasks << "default"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Finally, with the script fully loaded and command-line parsed, run
|
|
||||||
# the application to execute all required tasks.
|
|
||||||
Rscons.application.run(tasks)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def usage
|
def usage
|
||||||
|
@ -396,7 +396,7 @@ module Rscons
|
|||||||
options[:on_fail].call
|
options[:on_fail].call
|
||||||
end
|
end
|
||||||
if should_fail
|
if should_fail
|
||||||
raise RsconsError.new
|
raise RsconsError.new("Configuration failed")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2365,13 +2365,6 @@ EOF
|
|||||||
expect(result.stdout).to match /gcc.*-o.*\.o.*-DHAVE_MATH_H\s.*-DHAVE_STDIO_H/
|
expect(result.stdout).to match /gcc.*-o.*\.o.*-DHAVE_MATH_H\s.*-DHAVE_STDIO_H/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "exits with an error if the project is not configured and a build is requested and autoconf is false" do
|
|
||||||
test_dir "configure"
|
|
||||||
result = run_rscons(args: %w[-f autoconf_false.rb])
|
|
||||||
expect(result.stderr).to match /Project must be configured first, and autoconf is disabled/
|
|
||||||
expect(result.status).to_not eq 0
|
|
||||||
end
|
|
||||||
|
|
||||||
it "exits with an error code and message if configuration fails during autoconf" do
|
it "exits with an error code and message if configuration fails during autoconf" do
|
||||||
test_dir "configure"
|
test_dir "configure"
|
||||||
result = run_rscons(args: %w[-f autoconf_fail.rb])
|
result = run_rscons(args: %w[-f autoconf_fail.rb])
|
||||||
@ -2381,13 +2374,6 @@ EOF
|
|||||||
expect(lines(result.stderr).last).to eq "Configuration failed"
|
expect(lines(result.stderr).last).to eq "Configuration failed"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "exits with an error if configuration has not been performed before attempting to create an environment" do
|
|
||||||
test_dir "configure"
|
|
||||||
result = run_rscons(args: %w[-f error_env_construction_before_configure.rb])
|
|
||||||
expect(result.stderr).to match /Project must be configured before creating an Environment/
|
|
||||||
expect(result.status).to_not eq 0
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not rebuild after building with auto-configuration" do
|
it "does not rebuild after building with auto-configuration" do
|
||||||
test_dir "configure"
|
test_dir "configure"
|
||||||
result = run_rscons(args: %w[-f autoconf_rebuild.rb])
|
result = run_rscons(args: %w[-f autoconf_rebuild.rb])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user