From 923d5f7555c1f9a1b00dc89bcfc32068d1ada339 Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Sun, 17 Dec 2017 16:00:32 +0000 Subject: [PATCH] script: Add Scripts To Rule Them All --- .gitmodules | 3 +++ .travis.yml | 7 +------ script/bootstrap | 10 ++++++++++ script/cibuild | 25 +++++++++++++++++++++++++ script/setup | 13 +++++++++++++ script/test | 20 ++++++++++++++++++++ vendor/python-trezor | 1 + 7 files changed, 73 insertions(+), 6 deletions(-) create mode 100755 script/bootstrap create mode 100755 script/cibuild create mode 100755 script/setup create mode 100755 script/test create mode 160000 vendor/python-trezor diff --git a/.gitmodules b/.gitmodules index 920894a05..7b3b203bc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "vendor/nanopb"] path = vendor/nanopb url = https://github.com/nanopb/nanopb.git +[submodule "python-trezor"] + path = vendor/python-trezor + url = https://github.com/trezor/python-trezor.git diff --git a/.travis.yml b/.travis.yml index 1b354cfec..4301fd031 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,13 +26,8 @@ install: - pip2 install --user "protobuf==${PROTOBUF_VERSION}" script: - - make -C vendor/libopencm3 lib/stm32/f2 - - make -C vendor/nanopb/generator/proto - - make + - script/cibuild - make -C bootloader - - make -C fastflash - - make -C firmware/protob - - make -C firmware - make -C demo notifications: diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 000000000..4f687bf0e --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,10 @@ +#!/bin/bash + +# script/bootstrap: Resolve all dependencies that the application requires to +# run. + +set -e + +cd "$(dirname "$0")/.." + +git submodule update --init diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 000000000..023969661 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,25 @@ +#!/bin/bash + +# script/cibuild: Setup environment for CI to run tests. This is primarily +# designed to run on the continuous integration server. + +set -e + +cd "$(dirname "$0")/.." + +if [ "$EMULATOR" = 1 ]; then + make -C emulator +else + make -C vendor/libopencm3 lib/stm32/f2 +fi + +make + +if [ "$FASTFLASH" = 1 ]; then + make -C fastflash +fi + +make -C vendor/nanopb/generator/proto +make -C firmware/protob + +make -C firmware diff --git a/script/setup b/script/setup new file mode 100755 index 000000000..704168ece --- /dev/null +++ b/script/setup @@ -0,0 +1,13 @@ +#!/bin/bash + +# script/setup: Set up application for the first time after cloning, or set it +# back to the initial first unused state. + +set -e + +cd "$(dirname "$0")/.." + +script/bootstrap + +git clean -fdX +git submodule foreach git clean -fdX diff --git a/script/test b/script/test new file mode 100755 index 000000000..0c8e68d2b --- /dev/null +++ b/script/test @@ -0,0 +1,20 @@ +#!/bin/bash + +# script/test: Run test suite for application. + +set -e + +cd "$(dirname "$0")/.." + +# Kill jobs on exit +trap "exit" INT TERM +trap "kill 0" EXIT + +if [ "$EMULATOR" = 1 ]; then + firmware/trezor.elf & +fi + +TREZOR_TRANSPORT_V1=1 pytest "vendor/python-trezor/tests/device_tests" & + +# Wait for either job to exit and kill the other +wait -n diff --git a/vendor/python-trezor b/vendor/python-trezor new file mode 160000 index 000000000..90c49e338 --- /dev/null +++ b/vendor/python-trezor @@ -0,0 +1 @@ +Subproject commit 90c49e3386ee9391c2a57e2ca0a40f8a909a47cc