diff --git a/.gitmodules b/.gitmodules index 30ef58db1..df60ddab7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ [submodule "tests/plugins/PocketMine-DevTools"] path = tests/plugins/PocketMine-DevTools url = https://github.com/pmmp/PocketMine-DevTools.git +[submodule "tests/plugins/PocketMine-TesterPlugin"] + path = tests/plugins/PocketMine-TesterPlugin + url = https://github.com/pmmp/PocketMine-TesterPlugin.git diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index d39ceab3b..819df2399 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -234,7 +234,6 @@ namespace pocketmine { } return parse_offset($offset); - break; case 'linux': // Ubuntu / Debian. if(file_exists('/etc/timezone')){ @@ -261,7 +260,6 @@ namespace pocketmine { } return parse_offset($offset); - break; case 'mac': if(is_link('/etc/localtime')){ $filename = readlink('/etc/localtime'); @@ -272,10 +270,8 @@ namespace pocketmine { } return false; - break; default: return false; - break; } } diff --git a/src/pocketmine/scheduler/AsyncPool.php b/src/pocketmine/scheduler/AsyncPool.php index 22433690c..638169e00 100644 --- a/src/pocketmine/scheduler/AsyncPool.php +++ b/src/pocketmine/scheduler/AsyncPool.php @@ -136,6 +136,14 @@ class AsyncPool{ $this->taskWorkers = []; $this->tasks = []; + + $this->collectWorkers(); + } + + private function collectWorkers(){ + foreach($this->workers as $worker){ + $worker->collect(); + } } public function collectTasks(){ @@ -158,6 +166,8 @@ class AsyncPool{ } } + $this->collectWorkers(); + Timings::$schedulerAsyncTimer->stopTiming(); } } diff --git a/src/pocketmine/scheduler/AsyncTask.php b/src/pocketmine/scheduler/AsyncTask.php index 68491511c..cd50ac11e 100644 --- a/src/pocketmine/scheduler/AsyncTask.php +++ b/src/pocketmine/scheduler/AsyncTask.php @@ -261,7 +261,8 @@ abstract class AsyncTask extends Collectable{ $this->{$p} = null; } } - } + $this->setGarbage(); + } } diff --git a/tests/plugins/PocketMine-TesterPlugin b/tests/plugins/PocketMine-TesterPlugin new file mode 160000 index 000000000..a282b45c1 --- /dev/null +++ b/tests/plugins/PocketMine-TesterPlugin @@ -0,0 +1 @@ +Subproject commit a282b45c1d9d2108d602ccb5df7fdef4ef364232 diff --git a/tests/travis.sh b/tests/travis.sh index 4f53ec0a6..d57da86a1 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -17,7 +17,11 @@ if [ $? -ne 0 ]; then exit 1 fi -cp -r tests/plugins plugins +rm server.log 2> /dev/null +mkdir -p ./plugins + +cp -r tests/plugins/PocketMine-DevTools ./plugins + "$PHP_BINARY" ./plugins/PocketMine-DevTools/src/DevTools/ConsoleScript.php --make ./plugins/PocketMine-DevTools --relative ./plugins/PocketMine-DevTools --out ./plugins/DevTools.phar rm -rf ./plugins/PocketMine-DevTools @@ -28,3 +32,15 @@ else echo No phar created! exit 1 fi + +cp -r tests/plugins/PocketMine-TesterPlugin ./plugins +"$PHP_BINARY" src/pocketmine/PocketMine.php --no-wizard --disable-ansi --disable-readline --debug.level=2 + +result=$(grep 'TesterPlugin' server.log | grep 'Finished' | grep -v 'PASS') +if [ "$result" != "" ]; then + echo "$result" + echo Some tests did not complete successfully, changing build status to failed + exit 1 +else + echo All tests passed +fi