Skip to content

Commit

Permalink
tool/autopilot: rename 'get_cmd_[arg|switch]'-proc
Browse files Browse the repository at this point in the history
...to be consistent with the naming in tool/run.

Related to genodelabs#5432
  • Loading branch information
rite committed Feb 11, 2025
1 parent d2e697e commit b63284c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tool/autopilot
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ proc help { } {
##
# Return true if command-line switch was specified
#
proc get_cmd_switch { arg_name } {
proc have_cmd_arg { arg_name } {
global argv
return [expr [lsearch $argv $arg_name] >= 0]
}
Expand All @@ -110,7 +110,7 @@ proc wipe_test_dir { } {
# Remove build artifacts if commanded via the '--cleanup' argument
#
proc cleanup { } {
if {[get_cmd_switch --cleanup]} {
if {[have_cmd_arg --cleanup]} {
puts "cleaning up $test_dir"
wipe_test_dir
}
Expand Down Expand Up @@ -165,7 +165,7 @@ proc log_file { arch board kernel run_script } {
proc log_fd { arch board kernel run_script } {

# if '--stdout' was specified, don't write log output to files
if {[get_cmd_switch --stdout]} { return stdout }
if {[have_cmd_arg --stdout]} { return stdout }

# create file descriptor of log file on demand
global _log_fds
Expand Down Expand Up @@ -200,7 +200,7 @@ proc execute_run_script { arch board kernel run_script } {
set fd [log_fd $arch $board $kernel $run_script]

if {[catch {
if {[get_cmd_switch --time-stamp]} {
if {[have_cmd_arg --time-stamp]} {
exec make -C [build_dir $arch] [file join run $run_script] BOARD=$board KERNEL=$kernel \
|& ts "\[%F %H:%M:%S\]" >&@ $fd
} else {
Expand Down Expand Up @@ -257,7 +257,7 @@ proc build_dir_remainings { arch } {
proc build_failed_because_of_missing_run_script { arch board kernel run_script } {

# we cannot inspect any logfile when --stdout was used
if {[get_cmd_switch --stdout]} { return 0 }
if {[have_cmd_arg --stdout]} { return 0 }

# grep log output for the respective error message of the build system
if {[catch {
Expand All @@ -284,7 +284,7 @@ set make_jobs 2
foreach_cmdline_arg j { global make_jobs; set make_jobs $j }

# present help if explicitly requested
if {[get_cmd_switch --help]} { help; exit 0 }
if {[have_cmd_arg --help]} { help; exit 0 }

#
# Handle platform-kernel combinations by adding to targets
Expand Down Expand Up @@ -344,14 +344,14 @@ puts "make -j : $make_jobs"
# command-line arguments.
#

if {[file exists $test_dir] && ![get_cmd_switch --force] &&
![get_cmd_switch --keep]} {
if {[file exists $test_dir] && ![have_cmd_arg --force] &&
![have_cmd_arg --keep]} {
puts stderr "Error: test directory $test_dir already exists"
exit -3
}


if {[get_cmd_switch --force]} { wipe_test_dir }
if {[have_cmd_arg --force]} { wipe_test_dir }


proc append_run_opt { build_conf } {
Expand All @@ -378,7 +378,7 @@ foreach arch $architectures {
set build_dir [build_dir $arch]
set build_conf [file join $build_dir etc build.conf]

if {[get_cmd_switch --keep] && [file exists $build_dir]} {
if {[have_cmd_arg --keep] && [file exists $build_dir]} {
append_run_opt $build_conf
continue
}
Expand All @@ -403,7 +403,7 @@ foreach arch $architectures {
exec echo "MAKE += -j$make_jobs" >> $build_conf

# optionally enable ccache
if {[get_cmd_switch --enable-ccache]} {
if {[have_cmd_arg --enable-ccache]} {
set tools_conf [file join $build_dir etc tools.conf]
exec echo "CUSTOM_CC = ccache \$(CROSS_DEV_PREFIX)gcc" >> $tools_conf
exec echo "CUSTOM_CXX = ccache \$(CROSS_DEV_PREFIX)g++" >> $tools_conf
Expand Down Expand Up @@ -492,7 +492,7 @@ foreach arch $architectures {
}
}

if {[get_cmd_switch --skip-clean-rules]} continue
if {[have_cmd_arg --skip-clean-rules]} continue

# execute and validate cleanall rule
foreach target $targets {
Expand Down

0 comments on commit b63284c

Please sign in to comment.