From d67624c963fdd34ecdc75da2669b1b5546c5d2a4 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Thu, 5 Nov 2020 10:14:55 -0500 Subject: [PATCH] Set vm.bits property Signed-off-by: Sophia Guo --- .../jtreg-ext/requires/OpenJ9PropsExt.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/closed/test/jtreg-ext/requires/OpenJ9PropsExt.java b/closed/test/jtreg-ext/requires/OpenJ9PropsExt.java index d3047068e0f..502692177e7 100644 --- a/closed/test/jtreg-ext/requires/OpenJ9PropsExt.java +++ b/closed/test/jtreg-ext/requires/OpenJ9PropsExt.java @@ -1,6 +1,6 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved + * (c) Copyright IBM Corp. 2019, 2020 All Rights Reserved * =========================================================================== * * This code is free software; you can redistribute it and/or modify it @@ -30,15 +30,30 @@ import java.util.concurrent.Callable; public class OpenJ9PropsExt implements Callable> { - + private static final String ERROR_STATE = "__ERROR__"; @Override public Map call() { Map map = new HashMap<>(); map.put("vm.graal.enabled", "false"); + map.put("vm.bits", vmBits()); return map; } - + private String errorWithMessage(String message) { + new Exception(message).printStackTrace(); + return ERROR_STATE + message; + } + /** + * @return VM bitness, the value of the "sun.arch.data.model" property. + */ + protected String vmBits() { + String dataModel = System.getProperty("sun.arch.data.model"); + if (dataModel != null) { + return dataModel; + } else { + return errorWithMessage("Can't get 'sun.arch.data.model' property"); + } + } }