dayu521 / sponge

CS144 Lab Assignments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

  • Lab 0: networking warmup

  • Lab 1: stitching substrings into a byte stream

  • Lab 2: the TCP receiver

  • Lab 3: the TCP sender

  • Lab 4: the TCP connection

  • Lab 5: the network interface

  • Lab 6: the IP router

  • Lab 7: putting it all together

在我自己笔记本上(archlinux),通过了lab0-lab4的所有测试,lab1-lab4中的每个lab对应到相应分支,例如:lab1在lab1-startercode分支.而lab0在master分支

当利用github action跑测试案例时,lab4中的测试却有部分失败以及超时,不知道是不是github action的主机的一些类似于防火墙保护的问题(千万别是我自己代码的bug!)

直到lab4,之前的lab中存在的一些微妙问题没有被对应测试覆盖到,实际想来,还是过于依赖测试案例了。在lab4中修改了这些bug后,终于通过了lab4的测试,how tough it is!

====以下是原始lab说明====

For build prereqs, see the CS144 VM setup instructions.

Sponge quickstart

To set up your build directory:

$ mkdir -p <path/to/sponge>/build
$ cd <path/to/sponge>/build
$ cmake ..

Note: all further commands listed below should be run from the build dir.

To build:

$ make

You can use the -j switch to build in parallel, e.g.,

$ make -j$(nproc)

To test (after building; make sure you've got the build prereqs installed!)

$ make check_lab0

or

$ make check_lab1

etc.

The first time you run a make check, it may run sudo to configure two TUN devices for use during testing.

build options

You can specify a different compiler when you run cmake:

$ CC=clang CXX=clang++ cmake ..

You can also specify CLANG_TIDY= or CLANG_FORMAT= (see "other useful targets", below).

Sponge's build system supports several different build targets. By default, cmake chooses the Release target, which enables the usual optimizations. The Debug target enables debugging and reduces the level of optimization. To choose the Debug target:

$ cmake .. -DCMAKE_BUILD_TYPE=Debug

The following targets are supported:

  • Release - optimizations
  • Debug - debug symbols and -Og
  • RelASan - release build with ASan and UBSan
  • RelTSan - release build with ThreadSan
  • DebugASan - debug build with ASan and UBSan
  • DebugTSan - debug build with ThreadSan

Of course, you can combine all of the above, e.g.,

$ CLANG_TIDY=clang-tidy-6.0 CXX=clang++-6.0 .. -DCMAKE_BUILD_TYPE=Debug

Note: if you want to change CC, CXX, CLANG_TIDY, or CLANG_FORMAT, you need to remove build/CMakeCache.txt and re-run cmake. (This isn't necessary for CMAKE_BUILD_TYPE.)

other useful targets

To generate documentation (you'll need doxygen; output will be in build/doc/):

$ make doc

To lint (you'll need clang-tidy):

$ make -j$(nproc) tidy

To run cppcheck (you'll need cppcheck):

$ make cppcheck

To format (you'll need clang-format):

$ make format

To see all available targets,

$ make help

About

CS144 Lab Assignments


Languages

Language:C++ 82.4%Language:CMake 17.2%Language:Shell 0.2%Language:CSS 0.2%