mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-26 07:49:28 +01:00
prepare also script engines which currently are skipped
This commit is contained in:
parent
4e3c11553f
commit
c5d514de73
@ -122,6 +122,24 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare the rule for the script engine
|
||||||
|
*
|
||||||
|
* @param script
|
||||||
|
* the script engine
|
||||||
|
* @throws Exception
|
||||||
|
* if any error occur
|
||||||
|
*/
|
||||||
|
public void before( ScriptEngine script ) throws Exception {
|
||||||
|
switch( script ) {
|
||||||
|
case Wat2Wasm:
|
||||||
|
// this is already part of execute and not only a compile
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
createCommand( script );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the test data as JSON file.
|
* Write the test data as JSON file.
|
||||||
*
|
*
|
||||||
@ -370,6 +388,36 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile the sources and create the ProcessBuilder
|
||||||
|
*
|
||||||
|
* @param script
|
||||||
|
* The script engine
|
||||||
|
* @return ProcessBuilder to execute the test
|
||||||
|
* @throws Exception
|
||||||
|
* if any error occur
|
||||||
|
*/
|
||||||
|
private ProcessBuilder createCommand( ScriptEngine script ) throws Exception {
|
||||||
|
switch( script ) {
|
||||||
|
case SpiderMonkey:
|
||||||
|
return spiderMonkeyCommand( true, false );
|
||||||
|
case SpiderMonkeyWat:
|
||||||
|
return spiderMonkeyCommand( false, false );
|
||||||
|
case SpiderMonkeyGC:
|
||||||
|
return spiderMonkeyCommand( true, true );
|
||||||
|
case NodeJS:
|
||||||
|
return nodeJsCommand( nodeScript );
|
||||||
|
case NodeWat:
|
||||||
|
prepareNodeWat();
|
||||||
|
return nodeJsCommand( nodeWatScript );
|
||||||
|
case Wat2Wasm:
|
||||||
|
prepareWat2Wasm();
|
||||||
|
return nodeJsCommand( wat2WasmScript );
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException( script.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluate the wasm exported function.
|
* Evaluate the wasm exported function.
|
||||||
*
|
*
|
||||||
@ -395,30 +443,7 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
writeJsonTestData( Collections.singletonMap( methodName, params ) );
|
writeJsonTestData( Collections.singletonMap( methodName, params ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( script ) {
|
processBuilder = createCommand( script );
|
||||||
case SpiderMonkey:
|
|
||||||
processBuilder = spiderMonkeyCommand( true, false );
|
|
||||||
break;
|
|
||||||
case SpiderMonkeyWat:
|
|
||||||
processBuilder = spiderMonkeyCommand( false, false );
|
|
||||||
break;
|
|
||||||
case SpiderMonkeyGC:
|
|
||||||
processBuilder = spiderMonkeyCommand( true, true );
|
|
||||||
break;
|
|
||||||
case NodeJS:
|
|
||||||
processBuilder = nodeJsCommand( nodeScript );
|
|
||||||
break;
|
|
||||||
case NodeWat:
|
|
||||||
prepareNodeWat();
|
|
||||||
processBuilder = nodeJsCommand( nodeWatScript );
|
|
||||||
break;
|
|
||||||
case Wat2Wasm:
|
|
||||||
prepareWat2Wasm();
|
|
||||||
processBuilder = nodeJsCommand( wat2WasmScript );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException( script.toString() );
|
|
||||||
}
|
|
||||||
processBuilder.directory( getRoot() );
|
processBuilder.directory( getRoot() );
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
String result = readStream( process.getInputStream() ).trim();
|
String result = readStream( process.getInputStream() ).trim();
|
||||||
|
@ -17,6 +17,7 @@ package de.inetsoftware.jwebassembly.runtime;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
@ -66,6 +67,11 @@ public abstract class AbstractBaseTest {
|
|||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws Exception {
|
||||||
|
wasm.before( script );
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
wasm.test( script, method, params );
|
wasm.test( script, method, params );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user