2024-03-08 02:28:48 +01:00
|
|
|
require_relative "../setup"
|
|
|
|
module BSD::Control
|
|
|
|
class EnableFeatureTest < Test::Unit::TestCase
|
|
|
|
require "fileutils"
|
|
|
|
include FileUtils
|
|
|
|
|
|
|
|
def test_enable_feature_lacks_privileges
|
|
|
|
touch(file)
|
2024-03-09 23:40:42 +01:00
|
|
|
assert_raises(Errno::EPERM) do
|
2024-03-08 05:23:16 +01:00
|
|
|
BSD::Control.feature(:mprotect).enable!(file)
|
2024-03-08 02:28:48 +01:00
|
|
|
end
|
|
|
|
ensure
|
|
|
|
rm(file)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def file
|
|
|
|
File.join(__dir__, "file")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|