- Obtain private repos for free
- Go to Github and create a private repo:
- Don't do anything fancy yet (i.e. don't initialize the repo with a readme, don't add a .gitignore, etc)
- Just give it a name, make sure to choose "private," and then click "create repository"
- Clone this repo with
git clone https://github.com/justintemp/Pintos_Starter.git
- Cd into the folder you just cloned
cd Pintos_Starter
- Change the .git folder with
rm -rf .git
- Create a blank .git folder with
git init
- Change the remote repo to point to your own git repo. First go to your repo and find the
git remote add origin
command. Copy that line and then run it - Add all the code with
git add .
- Commit the code
git commit -m "initial commit"
- Push the code to your remote repo and set the upstream
git push --set-upstream origin master
- Make sure that the dependencies have been installed:
sudo apt-get update
sudo apt-get install qemu
sudo apt-get install realpath
- Run this command:
source install.sh
- If that doesn't work, read the error messages.
-
Cd into the
userprog
directory -
Run
make
-
Run
make check
- This should take around 5-10 minutes to finish. If you get a bunch of tests being run and at the end you get 76/76 test cases failed, then your installation worked
- If it doesn't finish (e.g. you get stuck in an infinte loop then the installation didn't work)
- If you are using a newer version of Linux and have an infinite loop, please follow the instructions here
- The final output should look like this
- Go into the directory for the current project (for the first pintos project, this will be the userprog directory):
cd userprog
- Build the directory with
make
- Run
make check
:- You'll see a lot of stuff being output, but if you're patient for about 10-30 minutes, you'll get a summary of your results at the end.
With the help of Dr. Google, I was able to write a convenient script for you all.
- Open up the
run_pintos_tests.sh
file in theuserprog
directory and change it to use the tests that you want to run - Simply add to (or remove from) the list of test files you see in the
TEST_FILES
variable - The list of all the tests can be seen by running
ls build/tests/userprog
(all of the green executables in here are test files)
Things to note
- You can redirect anything you don't care about to /dev/null
- The script redirects the result of the test to /dev/null and prints the output of the test by default. You can easily change this by changing the file redirection
This is rather cumbersome, so just bear with me.
First run make check
and then kill it with Ctrl-c after you get some output that looks like this:
cd build && make check
make[1]: Entering directory '/home/justin/Github/Pintos_Labs/userprog/build'
pintos -v -k -T 60 --qemu --filesys-size=2 -p tests/userprog/args-none -a args-none -- -q -f run args-none < /dev/null 2> tests/userprog/args-none.errors > tests/userprog/args-none.output
perl -I../.. ../../tests/userprog/args-none.ck tests/userprog/args-none tests/userprog/args-none.result
fail tests/userprog/args-none
There are three things for each test that gets run:
(1)
pintos -v -k -T 60 --qemu --filesys-size=2 -p tests/userprog/args-none -a args-none -- -q -f run args-none < /dev/null 2> tests/userprog/args-none.errors > tests/userprog/args-none.output
(2)
perl -I../.. ../../tests/userprog/args-none.ck tests/userprog/args-none tests/userprog/args-none.result
(3)
fail tests/userprog/args-none
You really only care about the first one. Copy the entire command except for everything after the < /dev/null
part since that is just used to redirect output and error messages (look familiar?)
Paste what you just copied onto the command line.
- Don't press enter yet
- Edit the beginning of the command to say
pintos --gdb
instead of justpintos
- Make sure the path is right (i.e. change the
tests/userprog/args-none
to have build/ in front of it:build/tests/userprog/args-none
- Now you can hit enter
You'll notice that the output is paused. This is because the pintos process you just ran is waiting for you to attach your GDB debugger.
Open up a new terminal tab with the shortcut Ctrl-Shift-t
- Run the script to attach your GDB debugger to the running pintos process:
./attachGdb.sh
- The script launches gdb with the
--tui
flag by default (you can remove this if you'd like) - The first command you should always run is
debugpintos
(nothing will work without running this) - Then you're all set
For a debugging demonstration in video form, please check out Dr. Yerraballi's video.