1 Star 2 Fork 0

PLOC / 凸语言

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
tests_all.sh 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
刘小东 提交于 2023-05-14 19:57 . release: all in one tests
#!/bin/bash
log(){
str="$1"
echo -e "\033[32m$str \033[0m "
}
clean() {
if ls $1 > /dev/null 2>&1; then
rm -rf $1
fi
}
failed(){
str="$1"
echo -e "\033[31m$str \033[0m"
ps aux|grep tests_asmer.sh|awk '{print $2}' |xargs kill -9
exit 1
}
check(){
if [ "$?" != 0 ]; then
# actual=`./a.out`
# if [ "$?" != 0 ]; then
failed "exec failed"
# fi
# rm ./a.out
fi
}
assert(){
expected="$1"
input="$2"
log "[compile] tu -s $input"
clean "*.s"
clean "*.o"
tu -s $input
check
log "[asmer] tu -c ."
tu -c .
echo "start linking..."
echo "tu -o . -o /usr/local/lib/colib"
tu -o . -o /usr/local/lib/colib
chmod 777 a.out
check
echo "exec a.out..."
./a.out
check
rm ./a.out
clean "*.s"
clean "*.o"
echo "exec done..."
return
# failed "[compile] $input failed"
}
read_dir(){
dir="$1"
cd $dir
for file in `ls *.tu`
do
echo $file
if [ -d $file ] ; then
read_dir $file
else
"clean *.s"
"clean *.o"
assert "OK" $file
log "[compile] $file passed!\n"
fi
done
cd ..
}
install_env(){
cd tests
if [ "$?" != 0 ]; then
failed "make failed"
fi
}
install_env
if [ "$1" != "" ]; then
read_dir $1
exit 0
fi
for dir in `ls`
do
if [ -d $dir ] ; then
read_dir $dir
clean "$dir/*.o"
clean "$dir/*.s"
fi
done
log "all passing...."
1
https://gitee.com/ploc-org/tulang.git
git@gitee.com:ploc-org/tulang.git
ploc-org
tulang
凸语言
main

搜索帮助