Skip to content

Instantly share code, notes, and snippets.

@vinlin24
Last active September 26, 2023 07:47
Show Gist options
  • Save vinlin24/b81bc99736890b349bb874a526c6c61f to your computer and use it in GitHub Desktop.
Save vinlin24/b81bc99736890b349bb874a526c6c61f to your computer and use it in GitHub Desktop.
Contributions to UCLA CS Lab Assignments

This is a list of contributions I made on my own initiative to make testing and debugging lab assignments easier for myself and hundreds of classmates. Every header is a link to the dedicated repository/Gist, so this Gist serves as a "linktree" of sorts.

⚠️ Some have been endorsed on Piazza, but these creations were never officially assigned by instructors nor were they meant to be a subtitute for the real grading mechanisms.

https://github.com/vinlin24/test-shuf (Expand for details)

Class: COM SCI 35L: Software Construction (Fall 2022)

An interactive TUI for testing our implementation for our Python scripting lab, where we were tasked with implementing the GNU shuf command but with Python and its argparse library.

This tester was motivated by the fact that the output of shuf is (obviously) random, so we could not use the straightforward approach of comparing the output of our shuf.py to the real shuf line by line. Pseudorandomness means that the output is technically deterministic if given the same seeds, but to my knowledge, there is no way to "use the same seed" across both programs as I explain in this exchange on our class Piazza:

image

The repository README is outfitted with details setup instructions as well as demo images.

https://github.com/vinlin24/rr-test-suite (Expand for details)

Class: COM SCI 111: Operating System Principles (Winter 2023)

A collection of useful scripts for students' development and testing workflow for our Process scheduling lab, where we were tasked with implementing a Round Robin scheduler.

The suite includes a Python version of the C starter code as well as scripts designed to work with an online process scheduling solver. The latter would be used to parse the HTML of the online solver output given the input parameters, thereby giving us a way to know the answer to our own test cases. This wasn't cheating, as I cheekily describe in my Piazza post:

image

As usual, setup and usage information is available on the repository README.

https://github.com/vinlin24/ext2-test-suite (Expand for details)

Class: COM SCI 111: Operating System Principles (Winter 2023)

A collection of useful scripts for students' development and testing workflow for our filesystem lab, where we were tasked with implementing a script to generate a valid ext2 filesystem image.

In this suite, I extended the Python unittest provided in the handout with more useful and comprehensive tests. I also provided some scripts to better sanity check students' progress as they practice incremental development, such as one that compares dumpe2fs output to the expected output provided by a TA.

As usual, setup and usage information as well as demo output is available on the repository README.

https://gist.github.com/vinlin24/ed40765c704e778d96a87dea67654277 (Expand for details)

Class: COM SCI 111: Operating System Principles (Winter 2023)

A Python script that simulates correctness and performance-checking of our implementation for our threading lab, where we were tasked with implementing a thread-safe hash table using mutex locks.

Basically, our TA had posted that for each test case of load (number of entries to insert into the hash table), we'll be tested 3 times:

  • If there's a correctness error (missing entry), that case is an immediate fail.
  • Otherwise if any trial passes some performance threshold (defined by the TA on Piazza), that case counts as a pass.

This lab was frustrating for all of us due to inconsistent and non-deterministic performance when running on either our VM and school server, which motivated me to write a script to run many trials in batch to "simulate" the test cases with incrementing values of hash table entries and output a summary all at once. Example output:

image

I also gave the script some command-line arguments. Usage instructions as shared in my Piazza post:

image

This script was itself an upgrade of a shell script I shared before this to just check for performance of a single run:

image

https://gist.github.com/vinlin24/5104f224f8b58178eb72a81bc14e667a (Expand for details)

Class: COM SCI 111: Operating System Principles (Winter 2023)

A Python script that filters the output of strace for lines relevant to our implementation of our pipe lab, where we were tasked with implementing the pipe operator in shell commands. Many students were struggling with determining if their implementation met the requirement of "properly closing all file descriptors", so I made this script to wrap strace, which was the canonical way to debug our program behavior.

Example usage and output as shared on Piazza:

image

etc.

Various other contributions.

At this point, I've done so much that this has become my legacy among my peers and I myself have likely lost track of whether this list itself is exhaustive.

  • Instructions on setting up Verilog with VS Code to simulate the environment of https://edaplayground.com/, which we used for our COM SCI M152A: Introductory Digital Design Laboratory.
  • A fork of the handout test suite for the Git internals lab of COM SCI 35L: Software Construction class, where we were tasked with implementing topological ordering on a Git commit graph. My fork was just to add a feature of selecting specific test cases to run via environment variables, making it easier on incremental development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment