Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/classes/modules/java.base/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Properties;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.VM;
import jdk.internal.reflect.ConstantPool;
import sun.nio.ch.Interruptible;
import sun.reflect.annotation.AnnotationType;
Expand Down Expand Up @@ -70,6 +71,9 @@ public class System {
// <2do> this is an approximation that isn't particularly safe since we don't
// initialize sun.misc.VM
//sun.misc.VM.booted();

//Loading all Properties to VM
VM.saveAndRemoveProperties(properties);
}

static JavaLangAccess createJavaLangAccess () {
Expand Down
1 change: 1 addition & 0 deletions src/peers/gov/nasa/jpf/vm/JPF_java_lang_System.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ int getSelectedSysPropsFromHost (MJIEnv env){
"java.home",
"java.version",
"java.io.tmpdir",
"os.name",
JAVA_CLASS_PATH
//... and probably some more
// <2do> what about -Dkey=value commandline options
Expand Down
31 changes: 31 additions & 0 deletions src/tests/gov/nasa/jpf/test/java/misc/VMTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package gov.nasa.jpf.test.java.misc;

import gov.nasa.jpf.util.test.TestJPF;
import jdk.internal.misc.VM;
import org.junit.Test;

/**
* Simple test to verify properties are loaded correctly to VM
*/
public class VMTest extends TestJPF {

/**
* Test to verify all the properties of System is loaded to VM
*/
@Test
public void getSavedPropertiesTest(){
if(verifyNoPropertyViolation()){
assertEquals(System.getProperties().size(),VM.getSavedProperties().size());
}
}

/**
* Test to verify property "os.name" is loaded in VM
*/
@Test
public void getSavedPropertyTest(){
if(verifyNoPropertyViolation()){
assertNotNull(VM.getSavedProperty("os.name"));
}
}
}