Commit 8b798750 authored by Yudi Zheng's avatar Yudi Zheng

add shadow string test

parent 13370baa
......@@ -25,7 +25,7 @@ final class NetReferenceHelper {
* extra payload attached.
*/
private static final short SPEC_POS = 63;
private static final long SPEC_MASK = (1L << 1) - 1;
private static final long SPEC_MASK = 1L << 63;
//
......
package ch.usi.dag.disl.test.suite.shadowstring.app;
public class TargetClass {
static void empty () {
}
public static void main(final String[] args) throws InterruptedException {
for (int i = 0; i< 20000; i ++) {
empty();
}
}
}
package ch.usi.dag.disl.test.suite.shadowstring.instr;
import ch.usi.dag.dislreserver.remoteanalysis.RemoteAnalysis;
import ch.usi.dag.dislreserver.shadow.ShadowObject;
import ch.usi.dag.dislreserver.shadow.ShadowString;
// NOTE that this class is not static anymore
public class CodeExecuted extends RemoteAnalysis {
public static void receiveObject (final ShadowObject o) {
if (o != null) {
System.out.println (o.toString ());
}
}
public static void receiveData (final ShadowString o) {
if (o != null) {
System.out.println (o.toString ());
}
}
public static void empty () {
}
@Override
public void atExit () {
}
@Override
public void objectFree (final ShadowObject netRef) {
}
}
package ch.usi.dag.disl.test.suite.shadowstring.instr;
import ch.usi.dag.dislre.REDispatch;
// Optimally, this class is automatically created on analysis machine
// and redefines during loading the CodeExecuted class on the client vm
// Even more optimally, this is automatically generated native class with same
// functionality
public class CodeExecutedRE {
private static short RO = REDispatch.registerMethod (
"ch.usi.dag.disl.test.suite.shadowstring.instr.CodeExecuted.receiveObject");
private static short RD = REDispatch.registerMethod (
"ch.usi.dag.disl.test.suite.shadowstring.instr.CodeExecuted.receiveData");
private static short EM = REDispatch.registerMethod (
"ch.usi.dag.disl.test.suite.shadowstring.instr.CodeExecuted.empty");
public static final String DATA = "shadowstring";
public static void sendObject () {
REDispatch.analysisStart (RO);
REDispatch.sendObject (DATA);
REDispatch.analysisEnd ();
}
public static void sendData () {
REDispatch.analysisStart (RD);
REDispatch.sendObjectPlusData (DATA);
REDispatch.analysisEnd ();
}
public static void empty () {
REDispatch.analysisStart (EM);
REDispatch.analysisEnd ();
}
}
package ch.usi.dag.disl.test.suite.shadowstring.instr;
import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.marker.BodyMarker;
public class DiSLClass {
@Before (marker = BodyMarker.class, scope = "TargetClass.main")
public static void onMethodEntrance () {
CodeExecutedRE.sendObject ();
}
@Before (marker = BodyMarker.class, scope = "TargetClass.empty")
public static void flush () {
CodeExecutedRE.empty ();
}
@AfterReturning (marker = BodyMarker.class, scope = "TargetClass.main")
public static void onMethodExit () {
CodeExecutedRE.sendData ();
}
}
package ch.usi.dag.disl.test.suite.shadowstring.junit;
import java.io.IOException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.suite.ShadowVmTest;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
@RunWith (JUnit4.class)
public class ShadowStringTest extends ShadowVmTest {
@Override
protected void _checkOutErr (
final ClientServerEvaluationRunner runner
) throws IOException {
runner.assertShadowOut ("evaluation.out.resource");
}
}
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