Skip to content

Commit a070c4c

Browse files
committed
Final content for live course
- Added Docker image documentation - `course` script now includes guard warning about files present in project expansion directory and offers optional deletion to clear expansion directory - Latest course project archive
1 parent e6aece2 commit a070c4c

File tree

3 files changed

+73
-12
lines changed

3 files changed

+73
-12
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dr. Surly’s School for Mad Scientists: Interaction Tests, Mocks & Refactoring in Embedded Software Docker Image
2+
Unit testing environment with ARM cross compiler, Unity, CMock, Ceedling, and Qemu emulator
3+
4+
## Contents
5+
* Testing tools
6+
* Ceedling 0.29.1
7+
* CMock 2.5.1
8+
* Unity 2.5.0
9+
* Environment
10+
* arm-none-eabi-gcc 6.3.1
11+
* Ruby 2.4.9
12+
* QEMU 1.1.2 (modified)
13+
* Course project
14+
15+
## Build
16+
17+
The project image is layered atop a base image. The project image contains the potentially changeable content of the testing tools and the project materials. If future content updates are necessary this produces a slim `docker pull` operation for students.
18+
19+
The base docker image contains the heavyweight, unchanging tools — gcc toolchain, Ruby, and our customized Qemu. All these are built from scratch or installed by package manager during image build. To limit the download size for students, this image should be squashed.
20+
21+
If the base image changes, it must be rebuilt first and then the project image must be rebuilt. If only the project image changes, only it must be rebuilt.
22+
23+
### Base Docker Image
24+
25+
Because of the Docker `--squash` option, this image must be built locally, manually tagged, and pushed to Docker Hub. Automated Docker Hub builds do not support the `--squash` option.
26+
27+
1. Update Dockerfile and/or assets.
28+
1. Build locally… `./build/base/run.sh`
29+
1. Tag locally `docker image tag throwtheswitch/drsurly-course2-base throwtheswitch/drsurly-course2-base:[tag]`
30+
1. `docker push throwtheswitch/drsurly-course2-base:[tag]`
31+
32+
### Project Docker Image
33+
34+
1. Update Dockerfile and/or assets. If base image has changed, be sure to update the tagged version of the base image at the top of build/release/Dockerfile before building the project image.
35+
1. For a local build… `./build/release/run.sh`. Local builds are optional or for development work. Ultimately, this build is automated at Docker Hub for tagging and release, triggered by Github commits.
36+
37+
## Usage
38+
39+
`docker run -it --rm -v <local project path>:/lab throwtheswitch/drsurly-course2[:tag]`
40+

assets/awesomesauce2.zip

-1.42 KB
Binary file not shown.

assets/course

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
11
#!/bin/bash
22

3+
TMP="/tmp/project"
4+
PROJECT_HOME="/lab"
5+
36
# If no command line parameters given, provide usage banner
47
if [ $# -eq 0 ]
58
then
69
cat <<-____HERE
710
Usage: setup
8-
setup Extract project to file system
11+
setup Extract project to $PROJECT_HOME
912
... Future utility options TBD
1013
1114
____HERE
1215
exit
1316
fi
1417

15-
18+
# Parameter check
1619
if [ "$1" != "setup" ]; then
1720
echo "Unrecognized parameter. Run with no parameters for help."
1821
exit
1922
fi
2023

24+
# Clear temporary directory just to be sure
25+
rm -rf "$TMP"
26+
27+
# Check if expansion target directory has anything in it
28+
if [ "$(ls -A $PROJECT_HOME)" ]; then
29+
# Confirm deletion of contents of project folder
30+
read -p "> $PROJECT_HOME is not empty (includes hidden files). Delete contents before extracting project [y/n]? " -n 1 -r
31+
if [[ $REPLY =~ ^[Yy]$ ]]
32+
then
33+
echo "> Clearing $PROJECT_HOME ..."
34+
rm -rf "$PROJECT_HOME"/*
35+
else
36+
echo "> Project extraction cancelled."
37+
exit
38+
fi
39+
fi
2140

2241
# Extract archive listing and regex to determine base directory of files
23-
basedir=`unzip -l /home/drsurly/awesomesauce2.zip | grep -E -o 'mvandervoord[^/]+' | head -1`
42+
BASEDIR=`unzip -l /home/drsurly/awesomesauce2.zip | grep -E -o 'mvandervoord[^/]+' | head -1`
2443

2544
# Extract the archive
26-
echo "Extracting project"
27-
unzip -q /home/drsurly/awesomesauce2.zip -d /tmp
45+
echo "> Extracting project..."
46+
unzip -q /home/drsurly/awesomesauce2.zip -d $TMP
2847

2948
# Delete any git junk -- first files and then directories
30-
find /tmp -type f -iname ".git*" -delete
31-
find /tmp -type d -name ".git" -exec rm -rf "{}" \;
49+
find $TMP -type f -iname ".git*" -delete
50+
find $TMP -type d -name ".git" -exec rm -rf "{}" \;
3251

3352
# Move extracted contents below $basedir to new base directory of /lab
34-
mv /tmp/$basedir/* /lab
53+
mv "$TMP/$BASEDIR"/* "$PROJECT_HOME"
54+
55+
chmod +x "$PROJECT_HOME"/start_lab
3556

36-
# Clean up /tmp
37-
rm -rf /tmp/*
57+
# Clean up temporary directory
58+
rm -rf "$TMP"
3859

39-
echo "Done"
40-
echo "See project contents in /lab"
60+
echo "> Done."
61+
echo "> See project contents in $PROJECT_HOME"

0 commit comments

Comments
 (0)