Giter Site home page Giter Site logo

minidecaf-tests's Introduction

minidecaf-tests

MiniDecaf 测例及测试脚本。

我们有两种测例

  • 普通测例(在 testcases/ 下):你的 MiniDecaf 要能成功编译这些测例到合法的汇编,然后正常返回(返回码为 0)。 我们会将你的编译结果的运行返回值与 GCC 编译结果的运行返回值比较,要求它们必须要完全相同。
  • 报错测例(在 failcases/ 下):你的 MiniDecaf 对于这些测例,要么不能正常返回(返回码非 0),要么不能生成合法汇编(例如输出中夹杂了报错信息)。 最好能够生成有用的报错信息,但不要求。

依赖

用法

直接运行 check.sh 即可,例如在 minidecaf-tests/ 目录下

$ ./check.sh

check.sh 支持如下参数,参数用法是 OPT=VALUE ./check.sh,多个 OPT-VALUE 对用空格隔开。 例如 STEP_UNTIL=1 PROJ_PATH=../minidecaf ./check.sh

参数名 类型 含义 默认值
STEP_FROM 1 到 12 的整数(不超过STEP_UNTIL 从哪个 step 开始测 1
STEP_UNTIL 1 到 12 的整数 测到哪个 step 12
PROJ_PATH 一个路径 你的 minidecaf 仓库的路径 ..

输出含义

  • OK 测试点通过
  • ERR 你的编译器崩了,或者输出的汇编格式不对
  • FAIL (testcase)编译出的汇编运行结果不对;(failcase)或者对于不合法输入没报错而是输出了合法汇编。

用于 debug 的中间文件

测例文件在 testcases/step*/*.cfailcases/step*/*.c,运行 ./check.sh 后同一目录下会有如下中间文件方便 debug

  • *.errERR 的错误信息
  • *.expected:用 gcc 编译运行得到的标准答案
  • *.actual:运行你的编译结果得到的答案,需要和上面一样
  • *.{gcc,my}:可执行文件

常见问题

遇到问题,请先尝试重设仓库,删除临时文件,撤销所有你的改动:

$ git clean -fdx
$ git checkout -- .

如果出错,除了下面内容也请阅读实验指导书的常见问题一节。

  • permission denied: ./check.sh
    • 需要给 check.sh 加执行权限 chmod +x check.sh
  • gcc not found 或 qemu not found
  • macOS 下找不到 realpath 命令
    ./check.sh: line 25: realpath: command not found
    ./check.sh: line 26: realpath: command not found
    ./check.sh: line 30: $asmfile: ambiguous redirect
    
    • 使用 Homebrew 安装 coreutils:brew install coreutils

参考

minidecaf-tests's People

Contributors

chyyuu avatar dangerggg avatar equation314 avatar g4197 avatar hoblovski avatar mashplant avatar namasikanam avatar roastduck avatar yylidiw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.