Skip to content

Commit

Permalink
refactor tests with CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hxuhack committed Dec 26, 2024
1 parent 44e5aba commit eddcc02
Show file tree
Hide file tree
Showing 51 changed files with 78 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rap/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
# The default version of the rustc compiler
channel = "nightly-2024-10-12"
channel = "nightly-2024-10-12-x86_64-unknown-linux-gnu"
components = ["rustc-dev", "rust-src", "llvm-tools-preview"]
4 changes: 4 additions & 0 deletions rap/rust-toolchain.toml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
# The default version of the rustc compiler
channel = "nightly-2024-10-12-x86_64-unknown-linux-gnu"
components = ["rustc-dev", "rust-src", "llvm-tools-preview"]
35 changes: 35 additions & 0 deletions tests/CI_leak/batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#该脚本在目录下为每个Cargo项目执行相同的命令直到报错

if [ $# -eq 0 ]; then
#脚本无参数时执行cargo clean
#Example: batch.sh
cmd="cargo clean"
else
#脚本有参数时按照给定参数执行cargo命令
#Example: batch.sh -uaf
cmd="cargo rap $@"
fi

# 查找并编译当前目录下的所有 Rust 项目
find . -type f -name "Cargo.toml" | while read -r cargo_file; do
# 获取 Cargo.toml 文件所在的目录
project_dir=$(dirname "$cargo_file")

echo "Processing project in: $project_dir"

# 切换到项目目录
pushd "$project_dir" > /dev/null

$cmd
if [ $? -ne 0 ]; then
# 如果命令失败,打印错误信息并退出循环
echo "Error: '$cmd' failed in $project_dir"
popd > /dev/null
exit 1
fi

# 返回原始目录
popd > /dev/null
done

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions tests/CI_uaf/batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#该脚本在目录下为每个Cargo项目执行相同的命令直到报错

if [ $# -eq 0 ]; then
#脚本无参数时执行cargo clean
#Example: batch.sh
cmd="cargo clean"
else
#脚本有参数时按照给定参数执行cargo命令
#Example: batch.sh -uaf
cmd="cargo rap $@"
fi

# 查找并编译当前目录下的所有 Rust 项目
find . -type f -name "Cargo.toml" | while read -r cargo_file; do
# 获取 Cargo.toml 文件所在的目录
project_dir=$(dirname "$cargo_file")

echo "Processing project in: $project_dir"

# 切换到项目目录
pushd "$project_dir" > /dev/null

$cmd
if [ $? -ne 0 ]; then
# 如果命令失败,打印错误信息并退出循环
echo "Error: '$cmd' failed in $project_dir"
popd > /dev/null
exit 1
fi

# 返回原始目录
popd > /dev/null
done

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn create_vec() -> *mut Vec<i32> {

fn main() {
let p = create_vec();
let v = unsafe {&mut *p};
v.push(4);
println!("{:?}", v);
// let v = unsafe {&mut *p};
// v.push(4);
// println!("{:?}", v);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit eddcc02

Please sign in to comment.