tests_ts3server.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. #!/bin/bash
  2. # Project: Game Server Managers - LinuxGSM
  3. # Author: Daniel Gibbs
  4. # License: MIT License, Copyright (c) 2017 Daniel Gibbs
  5. # Purpose: Travis CI Tests: Teamspeak 3 | Linux Game Server Management Script
  6. # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
  7. # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
  8. # Website: https://linuxgsm.com
  9. travistest="1"
  10. # Debugging
  11. if [ -f ".dev-debug" ]; then
  12. exec 5>dev-debug.log
  13. BASH_XTRACEFD="5"
  14. set -x
  15. fi
  16. version="171014"
  17. shortname="ts3"
  18. gameservername="ts3server"
  19. rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
  20. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  21. servicename="${selfname}"
  22. lockselfname=".${servicename}.lock"
  23. lgsmdir="${rootdir}/lgsm"
  24. logdir="${rootdir}/log"
  25. steamcmddir="${rootdir}/steamcmd"
  26. serverfiles="${rootdir}/serverfiles"
  27. functionsdir="${lgsmdir}/functions"
  28. libdir="${lgsmdir}/lib"
  29. tmpdir="${lgsmdir}/tmp"
  30. configdir="${lgsmdir}/config-lgsm"
  31. configdirserver="${configdir}/${gameservername}"
  32. configdirdefault="${lgsmdir}/config-default"
  33. ## GitHub Branch Select
  34. # Allows for the use of different function files
  35. # from a different repo and/or branch.
  36. githubuser="GameServerManagers"
  37. githubrepo="LinuxGSM"
  38. githubbranch="$TRAVIS_BRANCH"
  39. # Core Function that is required first
  40. core_functions.sh(){
  41. functionfile="${FUNCNAME}"
  42. fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
  43. }
  44. # Bootstrap
  45. # Fetches the core functions required before passed off to core_dl.sh
  46. # Fetches core functions
  47. fn_bootstrap_fetch_file(){
  48. remote_fileurl="${1}"
  49. local_filedir="${2}"
  50. local_filename="${3}"
  51. chmodx="${4:-0}"
  52. run="${5:-0}"
  53. forcedl="${6:-0}"
  54. md5="${7:-0}"
  55. # If the file is missing, then download
  56. if [ ! -f "${local_filedir}/${local_filename}" ]; then
  57. if [ ! -d "${local_filedir}" ]; then
  58. mkdir -p "${local_filedir}"
  59. fi
  60. # Defines curl path
  61. curlpath=$(command -v curl 2>/dev/null)
  62. # If curl exists download file
  63. if [ "$(basename ${curlpath})" == "curl" ]; then
  64. # trap to remove part downloaded files
  65. echo -ne " fetching ${local_filename}...\c"
  66. curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
  67. local exitcode=$?
  68. if [ ${exitcode} -ne 0 ]; then
  69. echo -e "\e[0;31mFAIL\e[0m\n"
  70. if [ -f "${lgsmlog}" ]; then
  71. echo -e "${remote_fileurl}" | tee -a "${lgsmlog}"
  72. echo "${curlcmd}" | tee -a "${lgsmlog}"
  73. fi
  74. exit 1
  75. else
  76. echo -e "\e[0;32mOK\e[0m"
  77. fi
  78. else
  79. echo "[ FAIL ] Curl is not installed"
  80. exit 1
  81. fi
  82. # make file chmodx if chmodx is set
  83. if [ "${chmodx}" == "chmodx" ]; then
  84. chmod +x "${local_filedir}/${local_filename}"
  85. fi
  86. fi
  87. if [ -f "${local_filedir}/${local_filename}" ]; then
  88. # run file if run is set
  89. if [ "${run}" == "run" ]; then
  90. source "${local_filedir}/${local_filename}"
  91. fi
  92. fi
  93. }
  94. fn_bootstrap_fetch_file_github(){
  95. github_file_url_dir="${1}"
  96. github_file_url_name="${2}"
  97. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  98. remote_remote_fileurl="${githuburl}"
  99. local_local_filedir="${3}"
  100. local_local_filename="${github_file_url_name}"
  101. chmodx="${4:-0}"
  102. run="${5:-0}"
  103. forcedldl="${6:-0}"
  104. md5="${7:-0}"
  105. # Passes vars to the file download function
  106. fn_bootstrap_fetch_file "${remote_remote_fileurl}" "${local_local_filedir}" "${local_local_filename}" "${chmodx}" "${run}" "${forcedldl}" "${md5}"
  107. }
  108. # Installer menu
  109. fn_print_center() {
  110. columns="$(tput cols)"
  111. line="$@"
  112. printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
  113. }
  114. fn_print_horizontal(){
  115. char="${1:-=}"
  116. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
  117. }
  118. # Bash Menu
  119. fn_install_menu_bash() {
  120. local resultvar=$1
  121. title=$2
  122. caption=$3
  123. options=$4
  124. fn_print_horizontal
  125. fn_print_center $title
  126. fn_print_center $caption
  127. fn_print_horizontal
  128. menu_options=()
  129. while read -r line || [[ -n "${line}" ]]; do
  130. var=$(echo "${line}" | awk -F "," '{print $2 " - " $3}')
  131. menu_options+=( "${var}" )
  132. done < $options
  133. menu_options+=( "Cancel" )
  134. select option in "${menu_options[@]}"; do
  135. if [ -n "${option}" ] && [ "${option}" != "Cancel" ]; then
  136. eval "$resultvar=\"${option/%\ */}\""
  137. fi
  138. break
  139. done
  140. }
  141. # Whiptail/Dialog Menu
  142. fn_install_menu_whiptail() {
  143. local menucmd=$1
  144. local resultvar=$2
  145. title=$3
  146. caption=$4
  147. options=$5
  148. height=${6:-40}
  149. width=${7:-80}
  150. menuheight=${8:-30}
  151. IFS=","
  152. menu_options=()
  153. while read -r line; do
  154. key=$(echo "${line}" | awk -F "," '{print $3}')
  155. val=$(echo "${line}" | awk -F "," '{print $2}')
  156. menu_options+=( ${val//\"} "${key//\"}" )
  157. done < $options
  158. OPTION=$(${menucmd} --title "${title}" --menu "${caption}" ${height} ${width} ${menuheight} "${menu_options[@]}" 3>&1 1>&2 2>&3)
  159. if [ $? == 0 ]; then
  160. eval "$resultvar=\"${OPTION}\""
  161. else
  162. eval "$resultvar="
  163. fi
  164. }
  165. # Menu selector
  166. fn_install_menu() {
  167. local resultvar=$1
  168. local selection=""
  169. title=$2
  170. caption=$3
  171. options=$4
  172. # Get menu command
  173. for menucmd in whiptail dialog bash; do
  174. if [ -x $(command -v ${menucmd}) ]; then
  175. menucmd=$(command -v ${menucmd})
  176. break
  177. fi
  178. done
  179. case "$(basename ${menucmd})" in
  180. whiptail|dialog)
  181. fn_install_menu_whiptail "${menucmd}" selection "${title}" "${caption}" "${options}" 40 80 30;;
  182. *)
  183. fn_install_menu_bash selection "${title}" "${caption}" "${options}";;
  184. esac
  185. eval "$resultvar=\"${selection}\""
  186. }
  187. # Gets server info from serverlist.csv and puts in to array
  188. fn_server_info(){
  189. IFS=","
  190. server_info_array=($(grep -aw "${userinput}" "${serverlist}"))
  191. shortname="${server_info_array[0]}" # csgo
  192. gameservername="${server_info_array[1]}" # csgoserver
  193. gamename="${server_info_array[2]}" # Counter Strike: Global Offensive
  194. }
  195. fn_install_getopt(){
  196. userinput="empty"
  197. echo "Usage: $0 [option]"
  198. echo -e ""
  199. echo "Installer - Linux Game Server Managers - Version ${version}"
  200. echo "https://linuxgsm.com"
  201. echo -e ""
  202. echo -e "Commands"
  203. echo -e "install |Select server to install."
  204. echo -e "servername |e.g $0 csgoserver. Enter the required servername will install it."
  205. echo -e "list |List all servers available for install."
  206. exit
  207. }
  208. fn_install_file(){
  209. local_filename="${gameservername}"
  210. if [ -e "${local_filename}" ]; then
  211. i=2
  212. while [ -e "${local_filename}-${i}" ] ; do
  213. let i++
  214. done
  215. local_filename="${local_filename}-${i}"
  216. fi
  217. cp -R "${selfname}" "${local_filename}"
  218. sed -i -e "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${local_filename}"
  219. sed -i -e "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${local_filename}"
  220. echo "Installed ${gamename} server as ${local_filename}"
  221. echo ""
  222. if [ ! -d "${serverfiles}" ]; then
  223. echo "./${local_filename} install"
  224. else
  225. echo "Remember to check server ports"
  226. echo "./${local_filename} details"
  227. fi
  228. echo ""
  229. exit
  230. }
  231. # Prevent from running this script as root.
  232. if [ "$(whoami)" == "root" ]; then
  233. if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]; then
  234. echo "[ FAIL ] Do NOT run this script as root!"
  235. exit 1
  236. else
  237. core_functions.sh
  238. check_root.sh
  239. fi
  240. fi
  241. # LinuxGSM installer mode
  242. if [ "${shortname}" == "core" ]; then
  243. userinput=$1
  244. datadir="${tmpdir}/data"
  245. serverlist="${datadir}/serverlist.csv"
  246. # Download the serverlist. This is the complete list of all supported servers.
  247. if [ -f "${serverlist}" ]; then
  248. rm "${serverlist}"
  249. fi
  250. fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "serverlist.csv" "nochmodx" "norun" "noforcedl" "nomd5"
  251. if [ ! -f "${serverlist}" ]; then
  252. echo "[ FAIL ] serverlist.csv could not be loaded."
  253. exit 1
  254. fi
  255. if [ "${userinput}" == "list" ]; then
  256. {
  257. awk -F "," '{print $2 "\t" $3}' "${serverlist}"
  258. } | column -s $'\t' -t | more
  259. exit
  260. elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then
  261. fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}"
  262. userinput="${result}"
  263. fn_server_info
  264. if [ "${result}" == "${gameservername}" ]; then
  265. fn_install_file
  266. elif [ "${result}" == "" ]; then
  267. echo "Install canceled"
  268. else
  269. echo "[ FAIL ] menu result does not match gameservername"
  270. echo "result: ${result}"
  271. echo "gameservername: ${gameservername}"
  272. fi
  273. elif [ -n "${userinput}" ]; then
  274. fn_server_info
  275. if [ "${userinput}" == "${gameservername}" ]; then
  276. fn_install_file
  277. fi
  278. else
  279. fn_install_getopt
  280. fi
  281. # LinuxGSM Server Mode
  282. else
  283. core_functions.sh
  284. # Load LinuxGSM configs
  285. # These are required to get all the default variables for the specific server.
  286. # Load the default config. If missing download it. If changed reload it.
  287. if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then
  288. mkdir -p "${configdirdefault}/config-lgsm/${gameservername}"
  289. fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
  290. fi
  291. if [ ! -f "${configdirserver}/_default.cfg" ]; then
  292. mkdir -p "${configdirserver}"
  293. echo -ne " copying _default.cfg...\c"
  294. cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
  295. exitcode=$?
  296. if [ ${exitcode} -ne 0 ]; then
  297. echo -e "\e[0;31mFAIL\e[0m\n"
  298. exit 1
  299. else
  300. echo -e "\e[0;32mOK\e[0m"
  301. fi
  302. else
  303. function_file_diff=$(diff -q ${configdirdefault}/config-lgsm/${gameservername}/_default.cfg ${configdirserver}/_default.cfg)
  304. if [ "${function_file_diff}" != "" ]; then
  305. fn_print_warn_nl "_default.cfg has been altered. reloading config."
  306. echo -ne " copying _default.cfg...\c"
  307. cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
  308. exitcode=$?
  309. if [ ${exitcode} -ne 0 ]; then
  310. echo -e "\e[0;31mFAIL\e[0m\n"
  311. exit 1
  312. else
  313. echo -e "\e[0;32mOK\e[0m"
  314. fi
  315. fi
  316. fi
  317. source "${configdirserver}/_default.cfg"
  318. # Load the common.cfg config. If missing download it
  319. if [ ! -f "${configdirserver}/common.cfg" ]; then
  320. fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
  321. source "${configdirserver}/common.cfg"
  322. else
  323. source "${configdirserver}/common.cfg"
  324. fi
  325. # Load the instance.cfg config. If missing download it
  326. if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then
  327. fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
  328. source "${configdirserver}/${servicename}.cfg"
  329. else
  330. source "${configdirserver}/${servicename}.cfg"
  331. fi
  332. # Load the linuxgsm.sh in to tmpdir. If missing download it
  333. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then
  334. fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5"
  335. fi
  336. # Prevents running of core_exit.sh for Travis.
  337. if [ "${travistest}" != "1" ]; then
  338. getopt=$1
  339. core_getopt.sh
  340. fi
  341. fi
  342. fn_currentstatus_tmux(){
  343. check_status.sh
  344. if [ "${status}" != "0" ]; then
  345. currentstatus="ONLINE"
  346. else
  347. currentstatus="OFFLINE"
  348. fi
  349. }
  350. fn_currentstatus_ts3(){
  351. check_status.sh
  352. if [ "${status}" != "0" ]; then
  353. currentstatus="ONLINE"
  354. else
  355. currentstatus="OFFLINE"
  356. fi
  357. }
  358. fn_setstatus(){
  359. fn_currentstatus_ts3
  360. echo""
  361. echo "Required status: ${requiredstatus}"
  362. counter=0
  363. echo "Current status: ${currentstatus}"
  364. while [ "${requiredstatus}" != "${currentstatus}" ]; do
  365. counter=$((counter+1))
  366. fn_currentstatus_ts3
  367. echo -ne "New status: ${currentstatus}\\r"
  368. if [ "${requiredstatus}" == "ONLINE" ]; then
  369. (command_start.sh > /dev/null 2>&1)
  370. else
  371. (command_stop.sh > /dev/null 2>&1)
  372. fi
  373. if [ "${counter}" -gt "5" ]; then
  374. currentstatus="FAIL"
  375. echo "Current status: ${currentstatus}"
  376. echo ""
  377. echo "Unable to start or stop server."
  378. exit 1
  379. fi
  380. done
  381. echo -ne "New status: ${currentstatus}\\r"
  382. echo -e "\n"
  383. echo "Test starting:"
  384. echo ""
  385. sleep 0.5
  386. }
  387. # End of every test will expect the result to either pass or fail
  388. # If the script does not do as intended the whole test will fail
  389. # if expecting a pass
  390. fn_test_result_pass(){
  391. if [ $? != 0 ]; then
  392. echo "================================="
  393. echo "Expected result: PASS"
  394. echo "Actual result: FAIL"
  395. fn_print_fail_nl "TEST FAILED"
  396. exitcode=1
  397. core_exit.sh
  398. else
  399. echo "================================="
  400. echo "Expected result: PASS"
  401. echo "Actual result: PASS"
  402. fn_print_ok_nl "TEST PASSED"
  403. echo ""
  404. fi
  405. }
  406. # if expecting a fail
  407. fn_test_result_fail(){
  408. if [ $? == 0 ]; then
  409. echo "================================="
  410. echo "Expected result: FAIL"
  411. echo "Actual result: PASS"
  412. fn_print_fail_nl "TEST FAILED"
  413. exitcode=1
  414. core_exit.sh
  415. else
  416. echo "================================="
  417. echo "Expected result: FAIL"
  418. echo "Actual result: FAIL"
  419. fn_print_ok_nl "TEST PASSED"
  420. echo ""
  421. fi
  422. }
  423. echo "================================="
  424. echo "Travis CI Tests"
  425. echo "Linux Game Server Manager"
  426. echo "by Daniel Gibbs"
  427. echo "Contributors: http://goo.gl/qLmitD"
  428. echo "https://linuxgsm.com"
  429. echo "================================="
  430. echo ""
  431. echo "================================="
  432. echo "Server Tests"
  433. echo "Using: ${gamename}"
  434. echo "Testing Branch: $TRAVIS_BRANCH"
  435. echo "================================="
  436. echo ""
  437. echo "0.1 - Create log dir's"
  438. echo "================================="
  439. echo "Description:"
  440. echo "Create log dir's"
  441. echo ""
  442. (install_logs.sh)
  443. echo "0.2 - Enable dev-debug"
  444. echo "================================="
  445. echo "Description:"
  446. echo "Enable dev-debug"
  447. echo ""
  448. (command_dev_debug.sh)
  449. fn_test_result_pass
  450. echo "1.0 - start - no files"
  451. echo "================================="
  452. echo "Description:"
  453. echo "test script reaction to missing server files."
  454. echo "Command: ./ts3server start"
  455. echo ""
  456. (command_start.sh)
  457. fn_test_result_fail
  458. echo ""
  459. echo "1.1 - getopt"
  460. echo "================================="
  461. echo "Description:"
  462. echo "displaying options messages."
  463. echo "Command: ./ts3server"
  464. echo ""
  465. (core_getopt.sh)
  466. fn_test_result_pass
  467. echo ""
  468. echo "1.2 - getopt with incorrect args"
  469. echo "================================="
  470. echo "Description:"
  471. echo "displaying options messages."
  472. echo "Command: ./ts3server abc123"
  473. echo ""
  474. getopt="abc123"
  475. (core_getopt.sh)
  476. fn_test_result_fail
  477. echo ""
  478. echo "2.0 - install"
  479. echo "================================="
  480. echo "Description:"
  481. echo "install ${gamename} server."
  482. echo "Command: ./ts3server auto-install"
  483. (fn_autoinstall)
  484. fn_test_result_pass
  485. echo ""
  486. echo "3.1 - start"
  487. echo "================================="
  488. echo "Description:"
  489. echo "start ${gamename} server."
  490. echo "Command: ./ts3server start"
  491. requiredstatus="OFFLINE"
  492. fn_setstatus
  493. (command_start.sh)
  494. fn_test_result_pass
  495. echo ""
  496. echo "3.2 - start - online"
  497. echo "================================="
  498. echo "Description:"
  499. echo "start ${gamename} server while already running."
  500. echo "Command: ./ts3server start"
  501. requiredstatus="ONLINE"
  502. fn_setstatus
  503. (command_start.sh)
  504. fn_test_result_fail
  505. echo ""
  506. echo "3.3 - start - updateonstart"
  507. echo "================================="
  508. echo "Description:"
  509. echo "will update server on start."
  510. echo "Command: ./ts3server start"
  511. requiredstatus="OFFLINE"
  512. fn_setstatus
  513. (updateonstart="on";command_start.sh)
  514. fn_test_result_pass
  515. echo ""
  516. echo "3.4 - stop"
  517. echo "================================="
  518. echo "Description:"
  519. echo "stop ${gamename} server."
  520. echo "Command: ./ts3server stop"
  521. requiredstatus="ONLINE"
  522. fn_setstatus
  523. (command_stop.sh)
  524. fn_test_result_pass
  525. echo ""
  526. echo "3.5 - stop - offline"
  527. echo "================================="
  528. echo "Description:"
  529. echo "stop ${gamename} server while already stopped."
  530. echo "Command: ./ts3server stop"
  531. requiredstatus="OFFLINE"
  532. fn_setstatus
  533. (command_stop.sh)
  534. fn_test_result_fail
  535. echo ""
  536. echo "3.6 - restart"
  537. echo "================================="
  538. echo "Description:"
  539. echo "restart ${gamename}."
  540. echo "Command: ./ts3server restart"
  541. requiredstatus="ONLINE"
  542. fn_setstatus
  543. (command_restart.sh)
  544. fn_test_result_pass
  545. echo ""
  546. echo "3.7 - restart - offline"
  547. echo "================================="
  548. echo "Description:"
  549. echo "restart ${gamename} while already stopped."
  550. echo "Command: ./ts3server restart"
  551. requiredstatus="OFFLINE"
  552. fn_setstatus
  553. (command_restart.sh)
  554. fn_test_result_pass
  555. echo "4.1 - update"
  556. echo "================================="
  557. echo "Description:"
  558. echo "check for updates."
  559. echo "Command: ./ts3server update"
  560. requiredstatus="OFFLINE"
  561. fn_setstatus
  562. (command_update.sh)
  563. fn_test_result_pass
  564. echo ""
  565. echo "5.1 - monitor - online"
  566. echo "================================="
  567. echo "Description:"
  568. echo "run monitor server while already running."
  569. echo "Command: ./ts3server monitor"
  570. requiredstatus="ONLINE"
  571. fn_setstatus
  572. (command_monitor.sh)
  573. fn_test_result_pass
  574. echo ""
  575. echo "5.2 - monitor - offline - with lockfile"
  576. echo "================================="
  577. echo "Description:"
  578. echo "run monitor while server is offline with lockfile."
  579. echo "Command: ./ts3server monitor"
  580. requiredstatus="OFFLINE"
  581. fn_setstatus
  582. fn_print_info_nl "creating lockfile."
  583. date > "${rootdir}/${lockselfname}"
  584. (command_monitor.sh)
  585. fn_test_result_pass
  586. echo ""
  587. echo "5.3 - monitor - offline - no lockfile"
  588. echo "================================="
  589. echo "Description:"
  590. echo "run monitor while server is offline with no lockfile."
  591. echo "Command: ./ts3server monitor"
  592. requiredstatus="OFFLINE"
  593. fn_setstatus
  594. (command_monitor.sh)
  595. fn_test_result_fail
  596. echo ""
  597. echo "6.0 - details"
  598. echo "================================="
  599. echo "Description:"
  600. echo "display details."
  601. echo "Command: ./ts3server details"
  602. requiredstatus="ONLINE"
  603. fn_setstatus
  604. (command_details.sh)
  605. fn_test_result_pass
  606. echo ""
  607. echo "6.1 - post details"
  608. echo "================================="
  609. echo "Description:"
  610. echo "post details."
  611. echo "Command: ./jc2server postdetails"
  612. requiredstatus="ONLINE"
  613. fn_setstatus
  614. (command_postdetails.sh)
  615. fn_test_result_pass
  616. echo ""
  617. echo "7.0 - backup"
  618. echo "================================="
  619. echo "Description:"
  620. echo "run a backup."
  621. echo "Command: ./jc2server backup"
  622. requiredstatus="ONLINE"
  623. fn_setstatus
  624. echo "test de-activated until issue #1839 fixed"
  625. #(command_backup.sh)
  626. fn_test_result_pass
  627. echo ""
  628. echo "8.0 - dev - detect glibc"
  629. echo "================================="
  630. echo "Description:"
  631. echo "detect glibc."
  632. echo "Command: ./jc2server detect-glibc"
  633. requiredstatus="ONLINE"
  634. fn_setstatus
  635. (command_dev_detect_glibc.sh)
  636. fn_test_result_pass
  637. echo ""
  638. echo "8.1 - dev - detect ldd"
  639. echo "================================="
  640. echo "Description:"
  641. echo "detect ldd."
  642. echo "Command: ./jc2server detect-ldd"
  643. requiredstatus="ONLINE"
  644. fn_setstatus
  645. (command_dev_detect_ldd.sh)
  646. fn_test_result_pass
  647. echo ""
  648. echo "8.2 - dev - detect deps"
  649. echo "================================="
  650. echo "Description:"
  651. echo "detect dependencies."
  652. echo "Command: ./jc2server detect-deps"
  653. requiredstatus="ONLINE"
  654. fn_setstatus
  655. (command_dev_detect_deps.sh)
  656. fn_test_result_pass
  657. echo ""
  658. echo "================================="
  659. echo "Server Tests - Complete!"
  660. echo "Using: ${gamename}"
  661. echo "================================="
  662. requiredstatus="OFFLINE"
  663. fn_setstatus
  664. fn_print_info "Tidying up directories."
  665. rm -rfv "${serverfiles}"
  666. core_exit.sh