]> git.pond.sub.org Git - empserver/blobdiff - src/scripts/nightly/nightlybuild.sh
First step to add testing of the server to the nightlybuild.
[empserver] / src / scripts / nightly / nightlybuild.sh
index 14596d9633068a0e2348460a2959b4d91f4f8b41..37da31247fe564d41d10f1340de7688a032b8ab2 100755 (executable)
@@ -89,6 +89,20 @@ done
 echo "Done (CVS)."
 echo ""
 
+echo "Applying global patches from patches/All:"
+for i in "${SCRIPTDIR}/patches/All"/*.patch
+do
+       [ -r "${i}" ] || continue
+       if patch -Np0 < "${i}" >/dev/null
+       then
+               echo "${i}: OK"
+       else
+               echo "========== ${i}: NOT OK! ${?} =========="
+       fi
+done
+echo "Done (patch All)."
+echo ""
+
 # Run local patches ${LOCALPATCHDIR}/*.patch
 case "${LOCALPATCHDIR}"
 in
@@ -101,7 +115,7 @@ esac
 
 if [ -n "${LOCALPATCHDIR}" -a -d "${LOCALPATCHDIR}/." ]
 then
-       echo "Applying local patches from ${LOCALPATCHDIR}:"
+       echo "Applying system specific patches from ${LOCALPATCHDIR}:"
        for i in "${LOCALPATCHDIR}"/*.patch
        do
                [ -r "${i}" ] || continue
@@ -112,7 +126,7 @@ then
                        echo "========== ${i}: NOT OK! ${?} =========="
                fi
        done
-       echo "Done (patch)."
+       echo "Done (patch specific)."
        echo ""
 fi
 
@@ -123,6 +137,7 @@ echo "Preparing build.conf"
 sed    -e "s,^USERNAME = .*$,USERNAME = ${EMPLOGIN}," \
        -e "s,^HOSTNAME = .*$,HOSTNAME = localhost," \
        -e "s,^IPADDR = .*$,IPADDR = 127.0.0.1," \
+       -e "s,^PORTNUM = .*$,PORTNUM = ${EMPPORT}," \
        -e "s,^EMPDIR = .*$,EMPDIR = ${BOXDIR}/${WORKDIR}/emp4," \
        < build.conf > build.conf.new && \
        mv build.conf.new build.conf || \
@@ -140,27 +155,124 @@ echo ""
 echo "Building server"
 if make "${EMPTARGET}" >/dev/null
 then
-       warn "make did not return 0."
+       warn "make did not return 0"
 fi
 echo "Done (make)."
 echo ""
 
 # Try to run startup utilities
-if [ -d ../emp4 -a -d ../emp4/bin -a -d ../emp4/data ]
-then
+for onetime in 1
+do
+       if [ -d ../emp4 -a -d ../emp4/bin -a -d ../emp4/data ]
+       then
+               echo "Directory structure is ok"
+       else
+               warn "Directory structure is NOT ok"
+               break
+       fi
+
        cd ../emp4/bin || err "Could not cd to ../emp4/bin"
+
        echo "Determining type of files in bindir"
        file *
        echo "Done (file *)."
        echo ""
+
        echo "Running files and fairland"
        echo y | ./files || warn "Error running files"
-       ./fairland 10 30 >/dev/null || warn "Error running fairland"
+       ./fairland -R 0 10 30 >/dev/null || { warn "Error running fairland" ; break ; }
+       [ -s "newcap_script" ] || { warn "fairland did not produce newcap_script" ; break ; }
        echo "Done (files & fairland)."
        echo ""
-fi
 
-# Clean sandbox
+       echo "Starting server with -d in the background"
+       ./emp_server -d &
+       PID="$!"
+       sleep 1
+       kill -0 "${PID}" || { warn "emp_server not running ?" ; break ; }
+       echo "Done (emp_server)."
+       echo ""
+
+       echo "Running newcap_script through emp_client"
+       runfeed POGO peter < newcap_script >/dev/null 2>&1 ||
+               {
+                       warn "Could not run newcap_script"
+                       echo "Stopping server"
+                       trykill $PID
+                       break
+               }
+       echo "Done (newcap_script / emp_client)."
+       echo ""
+       
+       # After a platform independent PRNG is used, we can really do some
+       # useful testing here...
+       echo "TODO: Replace this with a real test script as soon as"
+       echo "a platform independent PRNG is used in fairland."
+       echo ""
+       echo "Just do some rudimentary testing for now."
+       echo ""
+
+       echo "Preparing to ensure repeatable results"
+       runfeed POGO peter << EOF
+disable
+give uw * ?uw>0 5
+EOF
+       echo "Done (preparing)."
+       echo ""
+
+       for PLAYER in 1 2 3 4 5 6 7 8 9 10
+       do
+               echo "explore for player ${PLAYER}"
+               runfeed $PLAYER << EOF >/dev/null 2>&1
+break
+expl c 0,0 10 uh
+mov f 0,0 5 uh
+desi 1,-1 +
+cen *
+EOF
+               echo "Done (explore)."
+               echo ""
+       done
+
+       echo "Run an update"
+       runfeed POGO peter << EOF
+power new
+cen * ?own#0
+enable
+force 1
+disable
+EOF
+       echo "Done (force)."
+       echo ""
+
+       sleep 10
+       echo "Check player 1"
+       runfeed 1 << EOF
+cen *
+read n
+EOF
+       echo "Done (check)."
+       echo ""
+
+       echo "Check whether the update did anything"
+       runfeed POGO peter << EOF
+cen * ?own#0
+read
+n
+EOF
+       echo "Done (check update)."
+       echo ""
+
+       echo "Done (Rudimentary tests)."
+       echo ""
+
+       echo "Stopping server"
+       trykill "${PID}"
+       echo "Done (kill)."
+       echo ""
+done
+
+ Clean sandbox
 echo "Cleaning sandbox"
 cd "${BOXDIR}" || err "Could not cd back to sanbox root !"
 rm -r "${WORKDIR}" || warn "Directory ${WORKDIR} could not be cleanly removed !"