《MIT JOS Lab1: Booting a PC》实验代码


《MIT JOS Lab1: Booting a PC》实验代码,这是2019.9.10日为止最全的代码,满分版本,当然,我也查过了许多资料,再次做了资料整合以及一些我自己的理解。希望能使大家受益。
资源截图
代码片段和文件信息
from __future__ import print_function

import sys os re time socket select subprocess errno shutil traceback
from subprocess import check_call Popen
from optparse import OptionParser

__all__ = []

##################################################################
# Test structure
#

__all__ += [“test“ “end_part“ “run_tests“ “get_current_test“]

TESTS = []
TOTAL = POSSIBLE = 0
PART_TOTAL = PART_POSSIBLE = 0
CURRENT_TEST = None

def test(points title=None parent=None):
    “““Decorator for declaring test functions.  If title is None the
    title of the test will be derived from the function name by
    stripping the leading “test_“ and replacing underscores with
    spaces.“““

    def register_test(fn title=title):
        if not title:
            assert fn.__name__.startswith(“test_“)
            title = fn.__name__[5:].replace(“_“ “ “)
        if parent:
            title = “  “ + title

        def run_test():
            global TOTAL POSSIBLE CURRENT_TEST

            # Handle test dependencies
            if run_test.complete:
                return
            run_test.complete = True
            if parent:
                parent()

            # Run the test
            fail = None
            start = time.time()
            CURRENT_TEST = run_test
            sys.stdout.write(“%s: “ % title)
            sys.stdout.flush()
            try:
                fn()
            except Assertionerror as e:
                fail = ““.join(traceback.format_exception_only(type(e) e))

            # Display and handle test result
            POSSIBLE += points
            if points:
                print(“%s“ % 
                    (color(“red“ “FAIL“) if fail else color(“green“ “OK“)) end=‘ ‘)
            if time.time() - start > 0.1:
                print(“(%.1fs)“ % (time.time() - start) end=‘ ‘)
            print()
            if fail:
                print(“    %s“ % fail.replace(“
“ “
    “))
            else:
                TOTAL += points
            for callback in run_test.on_finish:
                callback(fail)
            CURRENT_TEST = None

        # Record test metadata on the test wrapper function
        run_test.__name__ = fn.__name__
        run_test.title = title
        run_test.complete = False
        run_test.on_finish = []
        TESTS.append(run_test)
        return run_test
    return register_test

def end_part(name):
    def show_part():
        global PART_TOTAL PART_POSSIBLE
        print(“Part %s score: %d/%d“ % 
            (name TOTAL - PART_TOTAL POSSIBLE - PART_POSSIBLE))
        print()
        PART_TOTAL PART_POSSIBLE = TOTAL POSSIBLE
    show_part.title = ““
    TESTS.append(show_part)

def run_tests():
    “““Set up for testing and run the registered test functions.“““

    # Handle command line
    global options
    parser = OptionParser(usage=“usage: %prog [-v] [filters...]“)
    parser.add_option(“-v“ “--verbose“ action=“store_true“
                      help=“prin

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        214  2019-09-10 08:14  jos01.dir-locals.el

     文件        859  2019-09-10 08:13  jos01.gdbinit

     文件        857  2019-09-10 08:14  jos01.gdbinit.tmpl

     文件         20  2019-09-10 08:13  jos01.gitCOMMIT_EDITMSG

     文件        272  2019-09-10 08:14  jos01.gitconfig

     文件         73  2019-09-10 08:13  jos01.gitdescription

     文件        105  2019-09-10 08:13  jos01.gitFETCH_HEAD

     文件         23  2019-09-10 08:13  jos01.gitHEAD

     文件        452  2019-09-10 08:13  jos01.githooksapplypatch-msg.sample

     文件        896  2019-09-10 08:13  jos01.githookscommit-msg.sample

     文件        189  2019-09-10 08:13  jos01.githookspost-update.sample

     文件        398  2019-09-10 08:13  jos01.githookspre-applypatch.sample

     文件       1704  2019-09-10 08:13  jos01.githookspre-commit.sample

     文件       1348  2019-09-10 08:13  jos01.githookspre-push.sample

     文件       4951  2019-09-10 08:13  jos01.githookspre-rebase.sample

     文件       1239  2019-09-10 08:13  jos01.githooksprepare-commit-msg.sample

     文件       3611  2019-09-10 08:13  jos01.githooksupdate.sample

     文件       6363  2019-09-10 08:13  jos01.gitindex

     文件        240  2019-09-10 08:14  jos01.gitinfoexclude

     文件        678  2019-09-10 08:13  jos01.gitlogsHEAD

     文件        678  2019-09-10 08:13  jos01.gitlogs
efsheadsmaster

     文件        304  2019-09-10 08:13  jos01.gitlogs
efs
emotesoriginmaster

     文件        285  2019-09-10 08:13  jos01.gitobjects1d3bdd6558ad57478bdb691c92bdb1066796780

     文件        145  2019-09-10 08:13  jos01.gitobjects322310a5fd9f803530badba8fac766d787affb7

     文件        829  2019-09-10 08:13  jos01.gitobjects78c3f9694c5a939d2ff1a9ec0b882aae6c748b1

     文件       6000  2019-09-10 08:13  jos01.gitobjects7a7a8460e12a680f09f8bd7e748a0709f171a0c

     文件         55  2019-09-10 08:13  jos01.gitobjects7c7a3b0a0ec07db1c6cd131fe1297bd47dd6d54

     文件       4177  2019-09-10 08:14  jos01.gitobjects93c8a6afff8e0e17e967f205c2ff35d2c3aa721

     文件        255  2019-09-10 08:13  jos01.gitobjectsbf46cb0e215158fe1fb0007a5b97371bca75d2b

     文件       3143  2019-09-10 08:13  jos01.gitobjectsc4ef13f5e1c3dc948147b5c8e60d1bee3977bdf

............此处省略436个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)