annotate buildall.bash @ 412:e7a3be42ae1e

Debug code for interconnect cable debugging
author Jacob Alexander <haata@kiibohd.com>
date Sat, 20 Feb 2016 13:27:49 -0800
parents 47a2714ca802
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
401
99f93dec8fea Start removing select Linux-isms
Dan McGregor <dan.mcgregor@usask.ca>
parents: 308
diff changeset
1 #!/usr/bin/env bash
57
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
2 ###| Builder Script |###
308
ab4515606277 Fix whitespace
Rowan Decker <Smasher816@gmail.com>
parents: 66
diff changeset
3 #
57
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
4 # Builds all permutations of modules
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
5 # This script is an attempt to maintain module sanity as new ones are added
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
6 #
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
7 # Fortunately, sweeping API changes don't happen much anymore...but just in case...
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
8 #
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
9 # Written by Jacob Alexander 2013 for the Kiibohd Controller
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
10 # Released into the Public Domain
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
11 #
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
12 ###
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
13
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
14 ## TODO List ##
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
15 # - Complete non-Scan module permutations (will take extra work)
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
16 # - Add command line arguments
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
17 # - Add help flag for usage
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
18 # - Make sure the script is being run from the correct directory
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
19
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
20
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
21 main() {
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
22 ERROR="\e[5;1;31mERROR\e[0m:"
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
23 failCount=0
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
24
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
25 # Scan for list of Scan Modules
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
26 scanModules=$(ls Scan)
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
27
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
28 # Prune out "invalid" modules (parent modules)
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
29 scanModules=${scanModules[@]//matrix/}
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
30
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
31 # Create permutation directories
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
32 # Then run cmake, and run each build permutation
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
33 # Keeping track of how many builds failed/passed
408
47a2714ca802 Ensure directories can only be made with printable characters
Ryan S. Brown <sb@ryansb.com>
parents: 401
diff changeset
34 for mod in $scanModules; do
47a2714ca802 Ensure directories can only be made with printable characters
Ryan S. Brown <sb@ryansb.com>
parents: 401
diff changeset
35 module=$(tr -dc "[:print:]" <<< "$mod")
57
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
36 # Create directory, but do not error if it exists already
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
37 mkdir -p build/$module
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
38 cd build/$module
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
39
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
40 # Make sure CMake has been run, and attempt to build
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
41 cmake -DScanModuleOverride=$module ../.. && make || let failCount++
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
42
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
43 # Cleanup, for the next build
66
0fdf103960c6 Updating CMake build system to prepare for Teensy 3 integration.
Jacob Alexander <triplehaata@gmail.com>
parents: 57
diff changeset
44 cd - > /dev/null
57
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
45 done
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
46
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
47 totalModules=$(echo $scanModules | wc -w)
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
48 if (( failCount > 0 )); then
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
49 echo -e "$ERROR $failCount/$totalModules failed"
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
50 else
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
51 echo -e "Build Success!"
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
52 fi
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
53 }
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
54
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
55
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
56 #| Main Script Entry
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
57 main "$@"
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
58
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
59
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
60 exit 0
a70deaf77afa Adding initial FACOM template, and buildall.bash regression script.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
61