mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 13:26:48 +00:00
Add shell cmd tests
This commit is contained in:
parent
6a90603200
commit
ee01113761
4
src/Cargo.lock
generated
4
src/Cargo.lock
generated
@ -596,9 +596,9 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "trapframe"
|
name = "trapframe"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/sdww0/trapframe-rs?rev=13e1065#13e106595d3cde9988e101e6b51e8fb9da38053d"
|
||||||
checksum = "f287ee70169f5bfddba441baf901b620e3655f16fa7815f48a7e100ec6d86a8f"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"log",
|
||||||
"raw-cpuid",
|
"raw-cpuid",
|
||||||
"x86_64",
|
"x86_64",
|
||||||
]
|
]
|
||||||
|
36
src/apps/scripts/test_cmd.sh
Executable file
36
src/apps/scripts/test_cmd.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
cd scripts
|
||||||
|
|
||||||
|
touch hello.txt
|
||||||
|
mv hello.txt hello_world.txt
|
||||||
|
rm hello_world.txt
|
||||||
|
|
||||||
|
awk '{print $2}' test_cmd.sh
|
||||||
|
cp test_cmd.sh test_cmd_backup.sh
|
||||||
|
cat test_cmd_backup.sh
|
||||||
|
rm test_cmd_backup.sh
|
||||||
|
|
||||||
|
ln -s test_cmd.sh tesk_cmd_soft_link
|
||||||
|
readlink -f tesk_cmd_soft_link
|
||||||
|
tail -n 1 tesk_cmd_soft_link
|
||||||
|
rm tesk_cmd_soft_link
|
||||||
|
|
||||||
|
ln test_cmd.sh tesk_cmd_hard_link
|
||||||
|
tail -n 1 tesk_cmd_hard_link
|
||||||
|
unlink tesk_cmd_hard_link
|
||||||
|
|
||||||
|
sed 3q test_cmd.sh
|
||||||
|
|
||||||
|
find . -name "*test_cmd*"
|
||||||
|
|
||||||
|
mkdir foo
|
||||||
|
rmdir foo
|
||||||
|
|
||||||
|
echo "Hello world from jinux" > hello.txt
|
||||||
|
rm hello.txt
|
||||||
|
|
||||||
|
cd ..
|
@ -26,6 +26,13 @@ pub fn load_program_to_root_vmar(
|
|||||||
fs_resolver: &FsResolver,
|
fs_resolver: &FsResolver,
|
||||||
recursion_limit: usize,
|
recursion_limit: usize,
|
||||||
) -> Result<ElfLoadInfo> {
|
) -> Result<ElfLoadInfo> {
|
||||||
|
// Temporary use because fs_resolver cannot deal with procfs now.
|
||||||
|
// FIXME: removes this when procfs is ready.
|
||||||
|
let executable_path = if &executable_path == "/proc/self/exe" {
|
||||||
|
current!().executable_path().unwrap().clone()
|
||||||
|
} else {
|
||||||
|
executable_path
|
||||||
|
};
|
||||||
let fs_path = FsPath::new(AT_FDCWD, &executable_path)?;
|
let fs_path = FsPath::new(AT_FDCWD, &executable_path)?;
|
||||||
let file = fs_resolver.open(&fs_path, AccessMode::O_RDONLY as u32, 0)?;
|
let file = fs_resolver.open(&fs_path, AccessMode::O_RDONLY as u32, 0)?;
|
||||||
let file_header = {
|
let file_header = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user