Skip to content

Commit

Permalink
Add require-os directive
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 25, 2024
1 parent 9ed77c6 commit 229817d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/grntest/executors/base-executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,23 @@ def execute_directive_require_env(line, content, options)
end
end

def os
status_response["os"]
end

def execute_directive_require_os(line, content, options)
required_os, = options
if required_os.start_with?("!")
if required_os[1..-1] == os
omit("require OS: #{required_os} (#{os})")
end
else
unless required_os == os
omit("require OS: #{required_os} (#{os})")
end
end
end

def execute_directive(parser, line, content)
command, *options = Shellwords.split(content)
case command
Expand Down Expand Up @@ -627,6 +644,8 @@ def execute_directive(parser, line, content)
execute_directive_finish_benchmark(line, content, options)
when "require-env"
execute_directive_require_env(line, content, options)
when "require-os"
execute_directive_require_os(line, content, options)
else
log_input(line)
log_error("#|e| unknown directive: <#{command}>")
Expand Down

0 comments on commit 229817d

Please sign in to comment.