diff --git a/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.bat b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.bat new file mode 100644 index 0000000000..f241493e0a --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.bat @@ -0,0 +1,2 @@ +@echo off +bash.exe misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh diff --git a/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh new file mode 100755 index 0000000000..f5a988df6c --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# This script would compile firmware, dev console and win32 simulator into a single bundle file +# This script depends on: zip + +SCRIPT_NAME="build_current_bundle" +ROOT_FOLDER=$(pwd) +echo "$SCRIPT_NAME Entering ROOT_FOLDER=$ROOT_FOLDER" + +echo "$SCRIPT_NAME.sh: Hello rusEFI build full bundle" +date "+%a %D %T.%2S" + +export BUNDLE_NAME="default" + +# As of 2023 default bundle comes without hard-coded UART connectivity - USB is king for modern stm32 rusEFI boards +# also OpenBLT is probably the more reasonable approach for UxART bootloader +#cd firmware/bootloader +#bash clean_bootloader.sh +#bash compile_bootloader_discovery407.sh +#[ -e bootloader_generated.hxx ] || { echo "FAILED TO COMPILE BOOTLOADER"; exit 1; } +#pwd +#cd ../.. +# At root folder here + +cd firmware +date "+%a %D %T.%2S" + +echo "$SCRIPT_NAME: will be Erasing chip" + +[ -e flash_erase407.sh ] || { echo "NOT FOUND flash_erase.sh"; exit 1; } +echo "$SCRIPT_NAME: Erasing chip" +bash flash_erase407.sh + +echo "$SCRIPT_NAME: Building firmware" +bash clean.sh + +bash update_version.sh + +bash clean_compile_two_versions.sh +#[ -e deliver/rusefi_no_asserts.hex ] || { echo "Just to confirm - FAILED to compile no_asserts"; exit 1; } + +[ -e deliver/rusefi.hex ] || { echo "Just to confirm - FAILED to compile default DEBUG"; exit 1; } + +echo "$SCRIPT_NAME: Building DFU" +if uname | grep "NT"; then + chmod u+x ../misc/encedo_hex2dfu/hex2dfu.exe + +# ../misc/encedo_hex2dfu/hex2dfu.exe -i deliver/rusefi_no_asserts.hex -o deliver/rusefi_no_asserts.dfu + ../misc/encedo_hex2dfu/hex2dfu.exe -i deliver/rusefi.hex -o deliver/rusefi.dfu +else + chmod u+x ../misc/encedo_hex2dfu/hex2dfu.bin +# ../misc/encedo_hex2dfu/hex2dfu.bin -i deliver/rusefi_no_asserts.hex -o deliver/rusefi_no_asserts.dfu + ../misc/encedo_hex2dfu/hex2dfu.bin -i deliver/rusefi.hex -o deliver/rusefi.dfu +fi + +echo "${SCRIPT_NAME} ls -l deliver" +ls -l deliver +cd .. + +# At root folder here + +bash misc/jenkins/build_java_console.sh || { echo "rusefi_console.jar build FAILED"; exit 1; } + +bash misc/jenkins/build_simulator.sh || { echo "rusefi_simulator.exe build FAILED"; exit 1; } + +STM_ARCH="stm32f407" +TIMESTAMP=$(date "+%Y%m%d_%H%M%S") + +if [ "$2" = "true" ]; then + FOLDER="rusefi.${1}.${STM_ARCH}" +else + FOLDER="rusefi.snapshot.${STM_ARCH}" +fi +echo "$SCRIPT_NAME: folder variable1=$FOLDER" +export FOLDER="temp/$FOLDER" +echo "$SCRIPT_NAME: folder variable3=$FOLDER" + +pwd +# DfuFlasher.java validates this prefix +export BUNDLE_FULL_NAME="rusefi_bundle" +bash misc/jenkins/build_working_folder.sh "$1" "$2" +[ $? -eq 0 ] || { echo "$SCRIPT_NAME: ERROR: invoking build_working_folder.sh"; exit 1; } + +echo "$SCRIPT_NAME: Going back to root folder" +cd "$ROOT_FOLDER" +pwd + +echo "TIMESTAMP $(date "+%a %D %T.%2S")" +pwd +echo "exiting $SCRIPT_NAME" diff --git a/misc/jenkins/functional_test_and_build_bundle/hw_test.bat b/misc/jenkins/functional_test_and_build_bundle/hw_test.bat new file mode 100644 index 0000000000..e94689a77d --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/hw_test.bat @@ -0,0 +1,2 @@ +@echo off +sh.exe misc/jenkins/functional_test_and_build_bundle.sh diff --git a/misc/jenkins/functional_test_and_build_bundle/hw_test.sh b/misc/jenkins/functional_test_and_build_bundle/hw_test.sh new file mode 100644 index 0000000000..85b23a18ff --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/hw_test.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "TIMESTAMP $(date "+%a %D %T.%2S")" +SCRIPT_NAME="hw_test.sh" +echo "Entering $SCRIPT_NAME" +pwd + +cd firmware +echo "$SCRIPT_NAME: erasing first" +bash flash_erase407.sh +echo "$SCRIPT_NAME: trying to flash" +# This script depends on someone else building firmware +bash flash_openocd407.sh +[ $? -eq 0 ] || { echo "ERROR invoking flash_openocd407.sh"; exit 1; } + +[ -e build/rusefi.bin ] || { echo "FIRMWARE NOT FOUND"; exit 1; } + +pwd + +cd .. + +# echo Running some commands +# pwd +# java -cp java_console_binary\rusefi_console.jar com.rusefi.CmdLine "set_led_blinking_period 10" + +cd java_console + +echo "Running tests" +which java +which javac +echo Sleeping few seconds to give OS time to connect VCP driver +sleep 20s +ant hardware_ci_f4_discovery + +[ $? -eq 0 ] || { echo "ERROR DETECTED"; exit 1; } + +echo "TIMESTAMP $(date "+%a %D %T.%2S")" +pwd +echo "exiting $SCRIPT_NAME" diff --git a/misc/jenkins/functional_test_and_build_bundle/readme.md b/misc/jenkins/functional_test_and_build_bundle/readme.md new file mode 100644 index 0000000000..5598a6efea --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/readme.md @@ -0,0 +1,8 @@ + +This configuration +1) builds bootloader from firmware/bootload just to validate that it builds (TODO: extract to separate job?) +1) compiles two versions of F4 version of firmware - with and without asserts, _fast_ and _debug_. +1) flashes _debug_ version of F4 into stm32f4discovery and runs a suite of tests against it. The source code +of tests is embedded into rusEfi console by the way (TODO: nicer UI for console to test F4 outside of Jenkins?) + +```misc/jenkins/functional_test_and_build_bundle/run.bat``` \ No newline at end of file diff --git a/misc/jenkins/functional_test_and_build_bundle/run.bat b/misc/jenkins/functional_test_and_build_bundle/run.bat new file mode 100644 index 0000000000..1c181e61a3 --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/run.bat @@ -0,0 +1,2 @@ +@echo off +sh.exe misc/jenkins/functional_test_and_build_bundle/run.sh diff --git a/misc/jenkins/functional_test_and_build_bundle/run.sh b/misc/jenkins/functional_test_and_build_bundle/run.sh new file mode 100644 index 0000000000..89c54ea3bf --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/run.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +git submodule update --init +bash misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh +[ $? -eq 0 ] || { echo "build ERROR DETECTED"; exit 1; } + +# bash misc/jenkins/functional_test_and_build_bundle/simulator_test.sh +# [ $? -eq 0 ] || { echo "simulator test ERROR DETECTED"; exit 1; } + +# Here we use last version of firmware produced by 'clean_compile_two_versions.bat' + +if [ ! "$RUSEFI_SKIP_HW" ] || [ "$RUSEFI_SKIP_HW" = "false" ]; then + sh misc/jenkins/functional_test_and_build_bundle/hw_test.sh + [ $? -eq 0 ] || { echo "real hardware test ERROR DETECTED"; exit 1; } +fi diff --git a/misc/jenkins/functional_test_and_build_bundle/simulator_test.bat b/misc/jenkins/functional_test_and_build_bundle/simulator_test.bat new file mode 100644 index 0000000000..061022c08c --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/simulator_test.bat @@ -0,0 +1,2 @@ +@echo off +sh.exe misc/jenkins/functional_test_and_build_bundle/simulator_test.sh diff --git a/misc/jenkins/functional_test_and_build_bundle/simulator_test.sh b/misc/jenkins/functional_test_and_build_bundle/simulator_test.sh new file mode 100755 index 0000000000..8ec19aa547 --- /dev/null +++ b/misc/jenkins/functional_test_and_build_bundle/simulator_test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo "I am simulator_test.sh" +pwd + +cd java_console + +echo "Running simulator functional test" +which java +which javac +ant simulator_test +[ $? -eq 0 ] || { echo "ERROR DETECTED"; exit 1; } + +echo "TIMESTAMP $(date "+%a %D %T.%2S")" +echo "simulator_test.sh: done" diff --git a/misc/jenkins/unit_tests/unit_tests.bat b/misc/jenkins/unit_tests/unit_tests.bat new file mode 100644 index 0000000000..de83bd8674 --- /dev/null +++ b/misc/jenkins/unit_tests/unit_tests.bat @@ -0,0 +1,41 @@ +echo "TIMESTAMP %date% %time% I am unit_tests.bat" + +rem 'RUSEFI_BUILD_FTP_PASS' environment variable + +echo We should be in root folder +pwd + +rem Prior to running unit tests we build real hardware firmware + +git submodule update --init + +cd firmware +call update_version.bat +IF NOT ERRORLEVEL 0 echo ERROR: INVOKING VERSION HEADER GENERATOR +IF NOT ERRORLEVEL 0 EXIT /B 1 +cd .. + +echo We are in root folder +pwd + +cd unit_tests +rem Clean build is needed since some file renames would produce a broken incremental build + +rem Only here we are building unit_tests +call clean_compile.bat +pwd +ls -l build +if not exist build/rusefi_test.exe echo ERROR: FAILED TO COMPILE UNIT TESTS +if not exist build/rusefi_test.exe exit -1 + +echo "TIMESTAMP %date% %time% Unit tests build looks good, now executing unit tests" + +call build\rusefi_test.exe +IF NOT ERRORLEVEL 0 echo ERROR: UNIT TEST FAILED +IF NOT ERRORLEVEL 0 EXIT /B 1 + +cd .. + +echo Back to root folder +pwd +