2024-05-12 05:59:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-03-08 00:27:20 +01:00
|
|
|
require_relative "../setup"
|
|
|
|
module BSD::Control
|
2024-05-13 03:32:55 +02:00
|
|
|
class EnableFeatureTest < BSD::Control::Test
|
2024-03-20 20:25:20 +01:00
|
|
|
def test_enable_pageexec
|
2024-05-13 03:32:55 +02:00
|
|
|
assert_equal true,
|
|
|
|
BSD::Control.feature(:pageexec).enable!(file)
|
2024-03-08 00:27:20 +01:00
|
|
|
end
|
|
|
|
|
2024-05-13 03:32:55 +02:00
|
|
|
def test_enable_pageexec_mode_zero
|
2024-03-08 02:28:48 +01:00
|
|
|
chmod(0, file)
|
2024-05-13 03:32:55 +02:00
|
|
|
assert_equal true,
|
|
|
|
BSD::Control.feature(:pageexec).enable!(file)
|
2024-03-08 02:28:48 +01:00
|
|
|
end
|
|
|
|
|
2024-03-20 20:25:20 +01:00
|
|
|
def test_enable_pageexec_nonexistent_file
|
2024-05-13 03:32:55 +02:00
|
|
|
rm(file)
|
2024-03-09 23:40:42 +01:00
|
|
|
assert_raises(Errno::ENOENT) do
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).enable!(file)
|
2024-03-08 00:27:20 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|