Browse Source

[TravisCI] run mysql test on Mac too

Andy Li 9 years ago
parent
commit
578bc18884
2 changed files with 9 additions and 8 deletions
  1. 6 5
      .travis.yml
  2. 3 3
      tests/unit/src/unit/Test.hx

+ 6 - 5
.travis.yml

@@ -103,11 +103,6 @@ matrix:
     - os: osx
     - os: osx
       env: TEST=python
       env: TEST=python
 
 
-before_script:
-  - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
-    mysql -u root -e "CREATE DATABASE haxe_test;";
-    fi
-
 install:
 install:
   # Install haxe and neko dependencies
   # Install haxe and neko dependencies
   - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
   - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
@@ -128,6 +123,12 @@ install:
       travis_retry brew install neko --HEAD;
       travis_retry brew install neko --HEAD;
     fi
     fi
 
 
+before_script:
+  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
+    travis_retry brew install mysql;
+    fi
+  - mysql -u root -e "CREATE DATABASE haxe_test;";
+
 script:
 script:
   - make package_src -s
   - make package_src -s
   - make -s
   - make -s

+ 3 - 3
tests/unit/src/unit/Test.hx

@@ -357,7 +357,7 @@ class Test {
 		// SPOD tests
 		// SPOD tests
 		#if ( (neko || (php && (travis || php_sqlite)) || java || cpp || (cs && travis)) && !macro && !interp)
 		#if ( (neko || (php && (travis || php_sqlite)) || java || cpp || (cs && travis)) && !macro && !interp)
 		#if ( travis && !(cpp || cs) )
 		#if ( travis && !(cpp || cs) )
-		if (Sys.getEnv("CI") != null && Sys.systemName() == "Linux")
+		if (Sys.getEnv("CI") != null && switch (Sys.systemName()) { case "Linux"|"Mac": true; case _: false; })
 		{
 		{
 			classes.push(new TestSpod(sys.db.Mysql.connect({
 			classes.push(new TestSpod(sys.db.Mysql.connect({
 				host : "localhost",
 				host : "localhost",
@@ -367,8 +367,8 @@ class Test {
 				database : "haxe_test" })));
 				database : "haxe_test" })));
 		}
 		}
 		#end
 		#end
-	  if (verbose)
-		 logVerbose("Setup sqlite");
+		if (verbose)
+			logVerbose("Setup sqlite");
 		classes.push(new TestSpod(sys.db.Sqlite.open("db.db3")));
 		classes.push(new TestSpod(sys.db.Sqlite.open("db.db3")));
 		#end
 		#end
 		TestIssues.addIssueClasses("src/unit/issues", "unit.issues");
 		TestIssues.addIssueClasses("src/unit/issues", "unit.issues");