mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
parent
edba179497
commit
7651c94bf5
@ -694,6 +694,7 @@ set default_test_pkgs {
|
||||
test-nic_loopback
|
||||
test-part_block_gpt
|
||||
test-part_block_mbr
|
||||
test-path
|
||||
test-pipe_read_ready
|
||||
test-pthread
|
||||
test-ram_fs_chunk
|
||||
|
1
repos/os/recipes/pkg/test-path/README
Normal file
1
repos/os/recipes/pkg/test-path/README
Normal file
@ -0,0 +1 @@
|
||||
'Genode::Path' test
|
2
repos/os/recipes/pkg/test-path/archives
Normal file
2
repos/os/recipes/pkg/test-path/archives
Normal file
@ -0,0 +1,2 @@
|
||||
_/src/init
|
||||
_/src/test-path
|
1
repos/os/recipes/pkg/test-path/hash
Normal file
1
repos/os/recipes/pkg/test-path/hash
Normal file
@ -0,0 +1 @@
|
||||
2024-02-08 3f9c9601fd6046b20953830c5290b354711accd7
|
52
repos/os/recipes/pkg/test-path/runtime
Normal file
52
repos/os/recipes/pkg/test-path/runtime
Normal file
@ -0,0 +1,52 @@
|
||||
<runtime ram="10M" caps="100" binary="test-path">
|
||||
|
||||
<requires> <timer/> </requires>
|
||||
|
||||
<fail after_seconds="10"/>
|
||||
|
||||
<succeed>
|
||||
[init] --- 'Genode::Path' test ---
|
||||
[init]
|
||||
[init] testing removal of superfluous slashes
|
||||
[init]
|
||||
[init] '//dir1///' -> '/dir1/'
|
||||
[init]
|
||||
[init] testing removal of superfluous dot-slashes
|
||||
[init]
|
||||
[init] '/./dir1/././' -> '/dir1/'
|
||||
[init] './dir1/././' -> './dir1/'
|
||||
[init]
|
||||
[init] testing removal of double dot dirs
|
||||
[init]
|
||||
[init] '/..' -> '/'
|
||||
[init] '/dir1/..' -> '/'
|
||||
[init] '/dir1/../..' -> '/'
|
||||
[init] '/dir1/dir2/..' -> '/dir1'
|
||||
[init] '/dir1/../dir2' -> '/dir2'
|
||||
[init] '/../dir1' -> '/dir1'
|
||||
[init] '/../../dir1' -> '/dir1'
|
||||
[init] '/../dir1/..' -> '/'
|
||||
[init] '..' -> ''
|
||||
[init] 'dir1/..' -> ''
|
||||
[init] 'dir1/../..' -> ''
|
||||
[init] 'dir1/dir2/..' -> 'dir1'
|
||||
[init] 'dir1/../dir2' -> 'dir2'
|
||||
[init] '../dir1' -> 'dir1'
|
||||
[init] '../../dir1' -> 'dir1'
|
||||
[init] '../dir1/..' -> ''
|
||||
[init]
|
||||
[init] testing removal of trailing dot
|
||||
[init]
|
||||
[init] '/dir1/.' -> '/dir1/'
|
||||
[init]
|
||||
[init] --- 'Genode::Path' test finished ---
|
||||
</succeed>
|
||||
|
||||
<content>
|
||||
<rom label="ld.lib.so"/>
|
||||
<rom label="test-path"/>
|
||||
</content>
|
||||
|
||||
<config/>
|
||||
|
||||
</runtime>
|
2
repos/os/recipes/src/test-path/content.mk
Normal file
2
repos/os/recipes/src/test-path/content.mk
Normal file
@ -0,0 +1,2 @@
|
||||
SRC_DIR = src/test/path
|
||||
include $(GENODE_DIR)/repos/base/recipes/src/content.inc
|
1
repos/os/recipes/src/test-path/hash
Normal file
1
repos/os/recipes/src/test-path/hash
Normal file
@ -0,0 +1 @@
|
||||
2024-02-08 f0e19cf36479e5ab7f6f5cfef1ddc910e6d729e7
|
2
repos/os/recipes/src/test-path/used_apis
Normal file
2
repos/os/recipes/src/test-path/used_apis
Normal file
@ -0,0 +1,2 @@
|
||||
base
|
||||
os
|
67
repos/os/src/test/path/main.cc
Normal file
67
repos/os/src/test/path/main.cc
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* \brief Tests for the 'Genode::Path' class
|
||||
* \author Christian Prochaska
|
||||
* \date 2024-02-08
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include <base/component.h>
|
||||
#include <base/log.h>
|
||||
#include <os/path.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
void Component::construct(Env &)
|
||||
{
|
||||
log("--- 'Genode::Path' test ---");
|
||||
|
||||
log("");
|
||||
log("testing removal of superfluous slashes");
|
||||
log("");
|
||||
|
||||
log("'//dir1///' -> '", Path<16>("//dir1///"), "'");
|
||||
|
||||
log("");
|
||||
log("testing removal of superfluous dot-slashes");
|
||||
log("");
|
||||
|
||||
log("'/./dir1/././' -> '", Path<16>("/./dir1/././"), "'");
|
||||
log("'./dir1/././' -> '", Path<16>("dir1/././", "./"), "'");
|
||||
|
||||
log("");
|
||||
log("testing removal of double dot dirs");
|
||||
log("");
|
||||
|
||||
log("'/..' -> '", Path<16>("/.."), "'");
|
||||
log("'/dir1/..' -> '", Path<16>("/dir1/.."), "'");
|
||||
log("'/dir1/../..' -> '", Path<16>("/dir1/../.."), "'");
|
||||
log("'/dir1/dir2/..' -> '", Path<16>("/dir1/dir2/.."), "'");
|
||||
log("'/dir1/../dir2' -> '", Path<16>("/dir1/../dir2"), "'");
|
||||
log("'/../dir1' -> '", Path<16>("/../dir1"), "'");
|
||||
log("'/../../dir1' -> '", Path<16>("/../../dir1"), "'");
|
||||
log("'/../dir1/..' -> '", Path<16>("/../dir1/.."), "'");
|
||||
|
||||
log("'..' -> '", Path<16>("", ".."), "'");
|
||||
log("'dir1/..' -> '", Path<16>("..", "dir1"), "'");
|
||||
log("'dir1/../..' -> '", Path<16>("../..", "dir1"), "'");
|
||||
log("'dir1/dir2/..' -> '", Path<16>("dir2/..", "dir1"), "'");
|
||||
log("'dir1/../dir2' -> '", Path<16>("../dir2", "dir1"), "'");
|
||||
log("'../dir1' -> '", Path<16>("dir1", ".."), "'");
|
||||
log("'../../dir1' -> '", Path<16>("../dir1", ".."), "'");
|
||||
log("'../dir1/..' -> '", Path<16>("dir1/..", ".."), "'");
|
||||
|
||||
log("");
|
||||
log("testing removal of trailing dot");
|
||||
log("");
|
||||
|
||||
log("'/dir1/.' -> '", Path<16>("/dir1/."), "'");
|
||||
|
||||
log("");
|
||||
log("--- 'Genode::Path' test finished ---");
|
||||
}
|
3
repos/os/src/test/path/target.mk
Normal file
3
repos/os/src/test/path/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = test-path
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
Loading…
Reference in New Issue
Block a user