Skip to content
Snippets Groups Projects
Commit 879a4d77 authored by Kenneth R Hancock's avatar Kenneth R Hancock
Browse files

README and install script also updates

parent 986654e9
No related branches found
No related tags found
No related merge requests found
# CS350 Container # CS350 Container
This is the CS350 Docker container that assists students who wish to have an This is CS350 Docker container repository. It includes the CS350 Docker container and the tools to build, run, debug and test OS/161 and Linux based programming assignments for CS350. This repository currently expects that you are running in a UNIX or UNIX-like environment that supports docker, such as, MacOS, Linux or Windows WSL.
isolated local environment for their os161 and userspace
assignments. This repo currently expects that you are running in a UNIX
environments that support docker (MacOS, Linux, or Windows WSL)
If you do not have access to this type of environment then you can use the If you have a Windows system without WSL, then start [here](https://git.uwaterloo.ca/krhancoc/cs350-container/-/edit/master/README.md#windows).
[older instructions](https://student.cs.uwaterloo.ca/~cs350/common/Install161.html) for the provided student environments.
If you do not have access to a UNIX or UNIX-like environment then you can use the
[older instructions](https://student.cs.uwaterloo.ca/~cs350/common/Install161.html) to build, run, debug and test in University of Waterloo's linux student environment.
## Windows
* Before you can install docker, you must have [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) installed.
* You can then [install docker](https://docs.docker.com/desktop/windows/install) for WSL
## Windows - Prerequistes to install a UNIX-like environment and Docker
* Install [WSL](https://docs.microsoft.com/en-us/windows/wsl/install).
* Install [docker](https://docs.docker.com/desktop/windows/install) for WSL.
## Requirements
* Docker [installed](https://docs.docker.com/engine/install/)
* Your own working copy of os161 (if you do not have one see the next section)
## UNIX and UNIX-like Environments - Prerequiste to install Docker
* Install [docker](https://docs.docker.com/engine/install/)
## Starting Fresh with OS161 ## Prerequiste - repository for OS/161 source code
If you are starting fresh and do not currently have a working copy of os161, you can retrieve your own by copying the * This repository assumes that you have a copy of the OS/161 source code on the local machine.
`os161.tar.gz` file within `os161-container/dependencies` directory. * You **should** have a remote repository to manage your OS/161 source code and move between the local and linux.student environments.
* If you do not currently have a working copy of os161, you can retrieve your own by copying the
`os161.tar.gz` file within `os161-container/dependencies` directory in the cs350-container repository.
``` ```
cp os161-container/dependencies/os161.tar.gz ~/ cp os161-container/dependencies/os161.tar.gz ~/
cd ~/ cd ~/
tar xzvf os161.tar.gz tar xzvf os161.tar.gz
``` ```
You should now have a folder called os161-1.99 in your home directory. Make this a git repo! You should now have a folder called `os161-1.99` in your home directory. Make this a git repository!
## Setup ## Prerequiste complete - install CS350-container
Once the above requirements are met, you run: Once the above requirements are met, you can clone this repository and install the cs350-container by typing:
``` ```
sudo ./install.sh sudo ./install.sh
``` ```
In a terminal from within the project directory. This script will pull the assignments reposiroty and build it into a local copy of the os161-runner image.
From within the project directory. This script will pull the assignments repo and build it into a local copy of the os161-runner image. ## Running OS161 in the cs350-container
To start using the container you use the run.sh script, which takes one argument -- the directory of your working code repository.
## Running OS161
To start using the container you use the run.sh script, which takes one argument -- the directory of your working code repo.
``` ```
sudo ./run.sh ~/os161-1.99 sudo ./run.sh ~/os161-1.99
``` ```
Once executed you will be within the context of the container itself (its like your own mini environment), you will have preloaded two Once executed you will be within the context of the container itself (its like your own mini environment), there are two functions (found at /helpers.sh within the container), `build_kernel ASST#`, and `test_kernel ASST#`. Where the `#` represents the
ease of use functions (found at /helpers.sh within the container), `build_kernel ASST#`, and `test_kernel ASST#`. Where the `#` signifies the assignment number. You can run these commands from the shell container. These functions are preloaded in your shell. For example, to build and run ASST0:
assignment number.
Within the container you may run within the shell (these functions are preloaded in your shell):
``` ```
# build_kernel ASST0 # build_kernel ASST0
# test_kernel ASST0 # test_kernel ASST0
``` ```
To build and run within the context of ASST0. Finally you may evaluate your assignment based off public test cases (there could be hidden ones not found within You can evaluate your assignment based on public test cases. There will be hidden test cases that are not avaiable in this repository.
the repo)
``` ```
# /evalaute /logs/test_public.log /assignments/ASST0 # /evalaute /logs/test_public.log /assignments/ASST0
``` ```
## Running GDB ## Running GDB
* Make sure you have built the kernel using `build_kernel ASST0`.
To run GDB, in a window with the container running and having built the kernel using the `build_kernel ASST0`: * To run GDB, open a terminal with the cs350-container running, and enter the following commands:
``` ```
# cd /os-compile/ # cd /os-compile/
# sys161 -w kernel # sys161 -w kernel
``` ```
Now in another terminal, move to this project directory and use the `./connect.sh` script to connect to the running container: * Now in another terminal, move to the project directory and use the `./connect.sh` script to connect to the previosuly running container:
``` ```
# cd /os-compile/ # cd /os-compile/
# cs350-gdb kernel # cs350-gdb kernel
...@@ -81,19 +74,19 @@ Copyright (C) 2006 Free Software Foundation, Inc. ...@@ -81,19 +74,19 @@ Copyright (C) 2006 Free Software Foundation, Inc.
... ...
``` ```
You will need to use the command `dir /kernel/kern/compile/ASST#` where `#` is the assignment number. This will make sure to load the symbols You will need to use the command `dir /kernel/kern/compile/ASST#` where `#` is the assignment number. This will make sure to load the symbols
of the kernel. Symbols are the names we have given functions and variables, this allows gdb to convey what you are looking at (this is because of the kernel. Symbols are the names we have given functions and variables. This allows gdb to correctly convey what you are looking at, since the kernel has been compiled WITH these symbols, otherwise gdb will show just bare assembly!
the kernel has been compiled WITH these symbols in mind), otherwise gdb will show just bare assembly!
Note: If `./connect.sh` does not work it may be because you have multiple running containers of os161-runner. Use `docker ps` to figure this out. Note: If run.sh fails it means there is still a os161-runner container running. Use `docker kill os161` to kill it.
This script is not a smart script just an ease of use script.
## Running other assignments ## Running other assignments
You may point the `run.sh` to any directory as all this does is makes sure that the directory is shared between the container and you. Allowing you to You may point the `run.sh` in any directory, the script makes sure that the directory is shared between the container and you. Allowing you to
continue to code and work on the files within the directoy and have the container running and seeing those changes. Further instructions will continue to code and work on the files within the directoy and have the container running and seeing those changes. Further instructions will
be given to the scripts used to run and evaluate userspace code. be given to the scripts used to run and evaluate userspace code.
When mounting other directories that are not os161 note that the `build_kernel` and `test_kernel` functionality will not work. When mounting other directories that are not os161 note that the `build_kernel` and `test_kernel` functionality will not work.
## Running, building and testing userspace code
*
## Layout ## Layout
There are some noted directories within the container There are some noted directories within the container
...@@ -102,16 +95,10 @@ There are some noted directories within the container ...@@ -102,16 +95,10 @@ There are some noted directories within the container
* `/os-compile` holds the compiled version of the code * `/os-compile` holds the compiled version of the code
* `/assignments` holds testing and evaluation scripts used for each assignment * `/assignments` holds testing and evaluation scripts used for each assignment
Within the `/assignments` directory there are subdirectories for each assignment, to see the test cases we pass and use, looks to the `public` file, Within the `/assignments` directory there are subdirectories for each assignment, which you can review:
to see how we run and build your assignment, see the `run.sh` file. Finally, to see how we automatically evaluate the output of your assignment, * the `public` file - shows the test cases we pass and use,
look at `verify.py` * the `run.sh` file - how we run and build your assignment,
* the `verify.py` script - how we evaluate the output of your assignment.
If the assignments repo has changed, either due to assignments being changed or bugs found (found at `os161-container/assignments`) you will need to pull this repo If the assignments repo has changed, either due to assignments being changed or bugs found (found at `os161-container/assignments`) you will need to just run `sudo ./install.sh` again.
and rebuild.
```
cd os161-container/assignments
git pull origin master
cd ../..
sudo docker build -t os161-runner os161-container
```
#/usr/bin/env bash #/usr/bin/env bash
ID=`docker ps -aqf "ancestor=os161-runner"` docker exec -it os161 /bin/bash
docker exec -it $ID /bin/bash
#!/usr/bin/env bash #!/usr/bin/env bash
git clone https://git.uwaterloo.ca/krhancoc/cs350-assignments.git os161-container/assignments echo "Cloning/Updating assignment directory"
git clone https://git.uwaterloo.ca/krhancoc/cs350-assignments.git os161-container/assignments > /dev/null 2> /dev/null
cd os161-container/assignments > /dev/null
git pull origin master > /dev/null 2> /dev/null
cd - > /dev/null
echo "Building CS350 container"
docker build -t os161-runner ./os161-container docker build -t os161-runner ./os161-container
#! /bin/sh #!/usr/bin/env bash
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
rm -rf logs rm -rf logs
set -e set -e
...@@ -7,6 +11,7 @@ if [ "$#" -ne 1 ];then ...@@ -7,6 +11,7 @@ if [ "$#" -ne 1 ];then
exit 1 exit 1
fi fi
mkdir -p logs mkdir -p logs
KERNFILE=$1 KERNFILE=$1
...@@ -15,4 +20,7 @@ docker run -it --rm \ ...@@ -15,4 +20,7 @@ docker run -it --rm \
-v `realpath os161-container/assignments`:/assignments \ -v `realpath os161-container/assignments`:/assignments \
-v `realpath logs`:/logs \ -v `realpath logs`:/logs \
--entrypoint /bin/bash \ --entrypoint /bin/bash \
--name os161 \
os161-runner os161-runner
docker kill os161 > /dev/null 2> /dev/null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment