setup.py 1.0 KB

123456789101112131415161718192021222324252627282930
  1. import subprocess
  2. import sys
  3. import os
  4. import setup_util
  5. from test_runner import TestRunner
  6. class Go(TestRunner):
  7. def start(self):
  8. setup_util.replace_text("go/src/hello/hello.go", "tcp\(.*:3306\)", "tcp(" + self.database_host + ":3306)")
  9. if os.name == 'nt':
  10. #subprocess.call("rmdir /s /q pkg\\windows_amd64", shell=True, cwd="go")
  11. #subprocess.call("rmdir /s /q src\\github.com", shell=True, cwd="go")
  12. #subprocess.call("del /s /q /f bin\\hello.exe", shell=True, cwd="go")
  13. self.sh("go get ./...")
  14. self.sh("setup.bat")
  15. return 0
  16. self.sh("go get ./...")
  17. self.pid = self.sh_async("go run -x -v src/hello/hello.go")
  18. return 0
  19. def stop(self):
  20. if os.name == 'nt':
  21. subprocess.call("taskkill /f /im go.exe > NUL", shell=True, stderr=errfile, stdout=logfile)
  22. subprocess.call("taskkill /f /im hello.exe > NUL", shell=True, stderr=errfile, stdout=logfile)
  23. return 0
  24. # Kill off the entire go process group
  25. self.sh_pkill(self.pid)
  26. return 0