Jenkins: Enable the lousy lapic timer since we don't have KVM
[akaros.git] / tools / jenkins / launcher.sh
index b1c8954..e906450 100755 (executable)
@@ -4,7 +4,7 @@
 # It analyzes what parts of the codebase have been modified, compiles everything
 # that is needed, and reports on the results. 
 
-set -e
+#set -e
 
 readonly TMP_DIR=tmp
 readonly DIFF_FILE=$TMP_DIR/changes.txt
@@ -93,6 +93,7 @@ function build_config() {
                   sed -i -e 's/CONFIG_64BIT=y/# CONFIG_64BIT is not set/' \
                          -e 's/# CONFIG_X86_32 is not set/CONFIG_X86_32=y/' \
                          -e 's/CONFIG_X86_64=y/# CONFIG_X86_64 is not set/' \
+                         -e 's/CONFIG_LOUSY_LAPIC_TIMER=y/# CONFIG_LOUSY_LAPIC_TIMER is not set/' \
                          .config
            ;;
        X86_64)  make ARCH=x86 defconfig
@@ -102,7 +103,7 @@ function build_config() {
        # Enable tests to run.
        # These don't take much to execute so we can run them always and just parse
        # results if needed.
-       echo "CONFIG_KERNEL_POSTBOOT_TESTING=y" >> .config
+       echo "CONFIG_KERNEL_TESTING=y" >> .config
        echo "CONFIG_USERSPACE_TESTING=y" >> .config
        # Set all config variables dependent on the above changes to their defaults
        # without prompting
@@ -135,8 +136,7 @@ X86_64_INSTDIR        := $WORKSPACE/install/${ARCH_SUBDIRS["X86_64"]}/
 
        # Create / clean directory where the cross compiler will be installed.
        CROSS_COMP_DIR=$WORKSPACE/install/${ARCH_SUBDIRS["$COMPILATION_ARCH"]}/
-       mkdir -p CROSS_COMP_DIR
-       rm -rf CROSS_COMP_DIR*
+       rm -rf $CROSS_COMP_DIR
 
        # Compile cross compiler.
        case "$COMPILATION_ARCH" in
@@ -206,13 +206,17 @@ function build_busybox() {
        cp busybox_unstripped ../../kern/kfs/bin/busybox
        cd ../../
 
-       # Recompile kernel to include busybox
-       echo -e "Recompile kernel to include busybox"
-       make
-
        echo -e "[BUILD_BUSYBOX]: End\n"
 }
 
+function build_all() {
+       build_config
+       build_cross_compiler
+       build_userspace
+       build_busybox
+       build_kernel
+}
+
 # TODO: This won't work for RISCV, it must be changed to whatever is used.
 function run_qemu() {
        echo -e "\n[RUN_AKAROS_IN_QEMU]: Begin"
@@ -252,56 +256,57 @@ function run_qemu() {
 
 if [ "$COMPILE_ALL" == true ]; then
        echo "Building all AKAROS"
-       build_config
-       
-       build_cross_compiler
-       build_userspace
-       build_busybox
-       build_kernel
-
+       build_all
        run_qemu
 
        AFFECTED_COMPONENTS="cross-compiler kernel userspace busybox"
 else
        # Save changed files between last tested commit and current one.
        git diff --stat $(last_stable_build) $GIT_COMMIT > $DIFF_FILE
-
-       # Extract build targets by parsing diff file.
-       AFFECTED_COMPONENTS=`$SCR_GIT_CHANGES $DIFF_FILE $CONF_COMP_COMPONENTS_FILE`
-       # Can contain {cross-compiler, kernel, userspace, busybox}
-
-       if [[ -n $AFFECTED_COMPONENTS ]]; 
-       then
-               echo "Detected changes in "$AFFECTED_COMPONENTS
-               build_config
-
-               if [[ $AFFECTED_COMPONENTS == *cross-compiler* ]]
+       if [ $? -ne 0 ]; then
+               echo "Diff failed, rebuild everything"
+               build_all
+               run_qemu
+
+               AFFECTED_COMPONENTS="cross-compiler kernel userspace busybox"
+       else 
+               # Extract build targets by parsing diff file.
+               AFFECTED_COMPONENTS=`$SCR_GIT_CHANGES $DIFF_FILE $CONF_COMP_COMPONENTS_FILE`
+               # Can contain {cross-compiler, kernel, userspace, busybox}
+
+               if [[ -n $AFFECTED_COMPONENTS ]]; 
                then
-                       build_cross_compiler
-                       build_userspace
-                       build_busybox
-                       build_kernel
-               else 
-                       if [[ $AFFECTED_COMPONENTS == *userspace* ]]
-                       then
-                               build_userspace
-                       fi
+                       echo "Detected changes in "$AFFECTED_COMPONENTS
+                       build_config
 
-                       if [[ $AFFECTED_COMPONENTS == *busybox* ]]
+                       if [[ $AFFECTED_COMPONENTS == *cross-compiler* ]]
                        then
+                               build_cross_compiler
+                               build_userspace
                                build_busybox
-                       fi
-
-                       if [[ $AFFECTED_COMPONENTS == *kernel* ]]
-                       then
                                build_kernel
+                       else 
+                               if [[ $AFFECTED_COMPONENTS == *userspace* ]]
+                               then
+                                       build_userspace
+                               fi
+
+                               if [[ $AFFECTED_COMPONENTS == *busybox* ]]
+                               then
+                                       build_busybox
+                               fi
+
+                               if [[ $AFFECTED_COMPONENTS == *kernel* ]]
+                               then
+                                       build_kernel
+                               fi
                        fi
+               else
+                       echo "Skipping build. No changes detected."
                fi
-       else
-               echo "Skipping build. No changes detected."
-       fi
 
-       run_qemu
+               run_qemu
+       fi
 fi