1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

Tests: Establish root Tests directory, move Userland/Tests there

With the goal of centralizing all tests in the system, this is a
first step to establish a Tests sub-tree. It will contain all of
the unit tests and test harnesses for the various components in the
system.
This commit is contained in:
Brian Gianforcaro 2021-05-06 01:14:50 -07:00 committed by Andreas Kling
parent 6e641fadfa
commit fd0dbd1ebf
49 changed files with 1 additions and 1 deletions

View file

@ -1,55 +0,0 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <unistd.h>
TEST_CASE(test_failures)
{
auto res = unveil("/etc", "r");
if (res < 0)
FAIL("unveil read only failed");
res = unveil("/etc", "w");
if (res >= 0)
FAIL("unveil write permitted after unveil read only");
res = unveil("/etc", "x");
if (res >= 0)
FAIL("unveil execute permitted after unveil read only");
res = unveil("/etc", "c");
if (res >= 0)
FAIL("unveil create permitted after unveil read only");
res = unveil("/tmp/doesnotexist", "c");
if (res < 0)
FAIL("unveil create on non-existent path failed");
res = unveil("/home", "b");
if (res < 0)
FAIL("unveil browse failed");
res = unveil("/home", "w");
if (res >= 0)
FAIL("unveil write permitted after unveil browse only");
res = unveil("/home", "x");
if (res >= 0)
FAIL("unveil execute permitted after unveil browse only");
res = unveil("/home", "c");
if (res >= 0)
FAIL("unveil create permitted after unveil browse only");
res = unveil(nullptr, nullptr);
if (res < 0)
FAIL("unveil state lock failed");
res = unveil("/bin", "w");
if (res >= 0)
FAIL("unveil permitted after unveil state locked");
}