Commit f87ced20 authored by Ivo Anjo's avatar Ivo Anjo

Update libjavartm-dummy with new doTransactionally API, and added some tests for it

parent 02398f9c
......@@ -56,3 +56,8 @@ JNIEXPORT void JNICALL Java_javartm_Transaction_abort__(JNIEnv *env, jclass cls)
JNIEXPORT void JNICALL Java_javartm_Transaction_abort__J(JNIEnv *env, jclass cls, jlong reason) {
throwException(env);
}
JNIEXPORT jobject JNICALL Java_javartm_Transaction_doTransactionally(JNIEnv *env, jclass cls, jobject runnable, jboolean warmup) {
throwException(env);
return NULL;
}
/*
* javartm: a Java library for Restricted Transactional Memory
* Copyright (C) 2013 Ivo Anjo <ivo.anjo@ist.utl.pt>
*
* This file is part of javartm.
*
* javartm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* javartm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with javartm. If not, see <http://www.gnu.org/licenses/>.
*/
package javartm.tests;
import javartm.Transaction;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.Assert;
/** Tests for the dummy fallback library, on machines that have no RTM support **/
@RunWith(JUnit4.class)
public class DummyTest1 {
@BeforeClass
public static void checkRtmStatus() {
Assert.assertFalse(DummyTest1.class.getName() + " can only be run on machines without RTM support",
Transaction.RTM_AVAILABLE);
}
@Test(expected=RuntimeException.class) public void testInTransaction() { Transaction.inTransaction(); }
@Test(expected=RuntimeException.class) public void testBegin() { Transaction.begin(); }
@Test(expected=RuntimeException.class) public void testCommit() { Transaction.commit(); }
@Test(expected=RuntimeException.class) public void testAbort() { Transaction.abort(); }
@Test(expected=RuntimeException.class) public void testAbort2() { Transaction.abort(0); }
@Test(expected=RuntimeException.class) public void testDoTransactionally() { Transaction.doTransactionally(null); }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment