summaryrefslogtreecommitdiffstats
path: root/jack/tests
diff options
context:
space:
mode:
authorJean-Philippe Lesot <jplesot@google.com>2015-03-11 14:07:59 -0700
committerJean-Philippe Lesot <jplesot@google.com>2015-03-12 08:18:29 -0700
commita673473ff01da4e2585dfc5a790a0b7086f6110b (patch)
treeec1cab282c619d4cdfe2ec09bd2444ee74226237 /jack/tests
parentb05d50f1ed81459e87431d653b0b40d5b8e3301e (diff)
downloadtoolchain_jack-a673473ff01da4e2585dfc5a790a0b7086f6110b.zip
toolchain_jack-a673473ff01da4e2585dfc5a790a0b7086f6110b.tar.gz
toolchain_jack-a673473ff01da4e2585dfc5a790a0b7086f6110b.tar.bz2
Rework Jack version management
Change-Id: Iba68600abba3291bc6d5eed206e32ab327cb125d
Diffstat (limited to 'jack/tests')
-rw-r--r--jack/tests/com/android/jack/AllUnitTests.java1
-rw-r--r--jack/tests/com/android/jack/TestTools.java2
-rw-r--r--jack/tests/com/android/jack/VersionTest.java47
3 files changed, 49 insertions, 1 deletions
diff --git a/jack/tests/com/android/jack/AllUnitTests.java b/jack/tests/com/android/jack/AllUnitTests.java
index 1193a23..eeb0905 100644
--- a/jack/tests/com/android/jack/AllUnitTests.java
+++ b/jack/tests/com/android/jack/AllUnitTests.java
@@ -36,6 +36,7 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses(value = {
+ VersionTest.class,
com.android.jack.cfg.AllTests.class,
com.android.jack.frontend.AllTests.class,
com.android.jack.gwt.AllTests.class,
diff --git a/jack/tests/com/android/jack/TestTools.java b/jack/tests/com/android/jack/TestTools.java
index ea79e92..01f383f 100644
--- a/jack/tests/com/android/jack/TestTools.java
+++ b/jack/tests/com/android/jack/TestTools.java
@@ -365,7 +365,7 @@ public class TestTools {
TestTools.createTempDir("unused", "").getPath(), hooks, Existence.MUST_EXIST,
Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE),
Permission.READ | Permission.WRITE),
- Jack.getEmitterId(), Jack.getVersionString());
+ Jack.getEmitterId(), Jack.getVersion().getVerboseVersion());
session.setJackOutputLibrary(outputLibrary);
PlanBuilder<JSession> planBuilder = request.getPlanBuilder(JSession.class);
diff --git a/jack/tests/com/android/jack/VersionTest.java b/jack/tests/com/android/jack/VersionTest.java
new file mode 100644
index 0000000..8029b7d
--- /dev/null
+++ b/jack/tests/com/android/jack/VersionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class VersionTest {
+ @BeforeClass
+ public static void setUpClass() {
+ Main.class.getClassLoader().setDefaultAssertionStatus(true);
+ }
+
+ @Test
+ public void testVersion() {
+ Version version = Jack.getVersion();
+
+ assertNotNull(version);
+ assertNotNull(version.getVersion());
+ assertNotNull(version.getVerboseVersion());
+ assertNotNull(version.getReleaseName());
+ assertTrue(version.getReleaseCode() > 0);
+ assertTrue(version.getSubReleaseCode() > 0);
+
+ if (version.getBuildId() == null || version.getCodeBase() == null) {
+ assertTrue(version.getSubReleaseKind() == SubReleaseKind.ENGINEERING);
+ }
+ }
+
+}