Commit Test for knsh

This commit is contained in:
Lup Yuen Lee 2024-11-20 10:42:29 +08:00
parent 78571275e8
commit 18a2e8ce28
2 changed files with 57 additions and 6 deletions

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash
## Special Build and Test NuttX for QEMU RISC-V 32-bit (Kernel Build)
function runme() {
script /tmp/special-qemu-riscv-knsh.log $HOME/riscv/nuttx-riscv64/special-qemu-riscv-knsh.sh
function test_once() {
commit=$1 ## Optional Commit ID
script /tmp/special-qemu-riscv-knsh.log \
$HOME/riscv/nuttx-riscv64/special-qemu-riscv-knsh.sh \
$commit
cat /tmp/special-qemu-riscv-knsh.log \
| tr -d '\r' \
| tr -d '\r' \
@ -19,12 +22,58 @@ function runme() {
--filename "special-qemu-riscv-knsh.log"
}
## Test 20 times
function stress_test() {
test_once
cd /tmp/special-qemu-riscv-knsh64/nuttx/nuttx
for i in {1..20}
do
echo "===== Attempt $i"
./qemu-riscv-knsh64.exp
if [ $? -ne 0 ]
then
echo "===== ERROR AT ATTEMPT $i"
break
fi
echo "===== $i Attempts Successful"
sleep 10
done
}
## Test by Past 50 Commits
function commit_test() {
date=$(date +'%Y-%m-%d-%H-%M-%S')
mkdir -p /tmp/$date
cd /tmp/$date
git clone https://github.com/apache/nuttx
cd nuttx
for commit in $(git log -50 --pretty=format:"%H")
do
echo Testing Commit $commit
git reset --hard $commit
sleep 5
test_once $commit
done
}
## Test by Another Past 50 Commits
function commit_test_again() {
for commit in $(git log -50 --pretty=format:"%H")
do
echo Testing Commit $commit
git reset --hard $commit
sleep 5
test_once $commit
done
}
## TODO: Set PATH
export PATH="$HOME/xpack-riscv-none-elf-gcc-13.2.0-2/bin:$PATH"
set -e # Exit when any command fails
set -x # Echo commands
commit=$1 ## Optional Commit ID
tmp_path=/tmp/special-qemu-riscv-knsh
rm -rf $tmp_path
mkdir $tmp_path
@ -79,9 +128,11 @@ neofetch
git clone https://github.com/apache/nuttx-apps apps
## Switch to this NuttX Commit
# pushd nuttx
# git reset --hard 6047a9fe146ad4b4e8b2dc7bffe92d9075db429f
# popd
if [[ "$commit" != "" ]]; then
pushd nuttx
git reset --hard $commit
popd
fi
cd .. #### Added this

View file

@ -156,7 +156,7 @@ neofetch
# - name: Build
# run: |
# set -x # Echo commands
# set -x # Echo commands
## Add toolchain to PATH
# export PATH=$PATH:$PWD/xpack-riscv-none-elf-gcc-13.2.0-2/bin