mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00:00
Tests: Use FileSystem
instead of DeprecatedFile
This commit is contained in:
parent
1c54c8a01c
commit
03008ec4e0
Notes:
sideshowbarker
2024-07-16 23:23:26 +09:00
Author: https://github.com/cammo1123
Commit: 03008ec4e0
Pull-request: https://github.com/SerenityOS/serenity/pull/18026
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/caoimhebyrne ✅
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/linusg
6 changed files with 615 additions and 565 deletions
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
#include <elf.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -58,10 +58,10 @@ TEST_CASE(test_interp_header_tiny_p_filesz)
|
|||
int nwritten = write(fd, buffer, sizeof(buffer));
|
||||
EXPECT(nwritten);
|
||||
|
||||
auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto elf_path_or_error = FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!elf_path_or_error.is_error());
|
||||
|
||||
auto elf_path = elf_path_or_error.release_value();
|
||||
auto elf_path = elf_path_or_error.release_value().to_deprecated_string();
|
||||
EXPECT(elf_path.characters());
|
||||
|
||||
int rc = execl(elf_path.characters(), "test-elf", nullptr);
|
||||
|
@ -115,10 +115,10 @@ TEST_CASE(test_interp_header_p_filesz_larger_than_p_memsz)
|
|||
int nwritten = write(fd, buffer, sizeof(buffer));
|
||||
EXPECT(nwritten);
|
||||
|
||||
auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto elf_path_or_error = FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!elf_path_or_error.is_error());
|
||||
|
||||
auto elf_path = elf_path_or_error.release_value();
|
||||
auto elf_path = elf_path_or_error.release_value().to_deprecated_string();
|
||||
EXPECT(elf_path.characters());
|
||||
|
||||
int rc = execl(elf_path.characters(), "test-elf", nullptr);
|
||||
|
@ -176,10 +176,10 @@ TEST_CASE(test_interp_header_p_filesz_plus_p_offset_overflow_p_memsz)
|
|||
int nwritten = write(fd, buffer, sizeof(buffer));
|
||||
EXPECT(nwritten);
|
||||
|
||||
auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto elf_path_or_error = FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!elf_path_or_error.is_error());
|
||||
|
||||
auto elf_path = elf_path_or_error.release_value();
|
||||
auto elf_path = elf_path_or_error.release_value().to_deprecated_string();
|
||||
EXPECT(elf_path.characters());
|
||||
|
||||
int rc = execl(elf_path.characters(), "test-elf", nullptr);
|
||||
|
@ -234,10 +234,10 @@ TEST_CASE(test_load_header_p_memsz_zero)
|
|||
int nwritten = write(fd, buffer, sizeof(buffer));
|
||||
EXPECT(nwritten);
|
||||
|
||||
auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto elf_path_or_error = FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!elf_path_or_error.is_error());
|
||||
|
||||
auto elf_path = elf_path_or_error.release_value();
|
||||
auto elf_path = elf_path_or_error.release_value().to_deprecated_string();
|
||||
EXPECT(elf_path.characters());
|
||||
|
||||
int rc = execl(elf_path.characters(), "test-elf", nullptr);
|
||||
|
@ -292,10 +292,10 @@ TEST_CASE(test_load_header_p_memsz_not_equal_to_p_align)
|
|||
int nwritten = write(fd, buffer, sizeof(buffer));
|
||||
EXPECT(nwritten);
|
||||
|
||||
auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
auto elf_path_or_error = FileSystem::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
|
||||
EXPECT(!elf_path_or_error.is_error());
|
||||
|
||||
auto elf_path = elf_path_or_error.release_value();
|
||||
auto elf_path = elf_path_or_error.release_value().to_deprecated_string();
|
||||
EXPECT(elf_path.characters());
|
||||
|
||||
int rc = execl(elf_path.characters(), "test-elf", nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue