srowen commented on a change in pull request #29407:
URL: https://github.com/apache/spark/pull/29407#discussion_r473048360
##########
File path: core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala
##########
@@ -144,10 +144,28 @@ class BlockManagerSuite extends SparkFunSuite with
Matchers with BeforeAndAfterE
blockManager
}
+ // Save modified system properties so that we can restore them after tests.
+ val originalArch = System.getProperty("os.arch")
+ val originalCompressedOops = System.getProperty(TEST_USE_COMPRESSED_OOPS_KEY)
+
+ def reinitializeSizeEstimator(arch: String, useCompressedOops: String): Unit
= {
+ val set = (k: String, v: String) => {
Review comment:
Minor but, just a `def`?
##########
File path: core/src/test/scala/org/apache/spark/storage/MemoryStoreSuite.scala
##########
@@ -51,12 +52,34 @@ class MemoryStoreSuite
implicit def StringToBlockId(value: String): BlockId = new TestBlockId(value)
def rdd(rddId: Int, splitId: Int): RDDBlockId = RDDBlockId(rddId, splitId)
+ // Save modified system properties so that we can restore them after tests.
+ val originalArch = System.getProperty("os.arch")
+ val originalCompressedOops = System.getProperty(TEST_USE_COMPRESSED_OOPS_KEY)
+
+ def reinitializeSizeEstimator(arch: String, useCompressedOops: String): Unit
= {
+ val set = (k: String, v: String) => {
+ if (v == null) {
+ System.clearProperty(k)
+ } else {
+ System.setProperty(k, v)
+ }
+ }
+ set("os.arch", arch)
+ set(TEST_USE_COMPRESSED_OOPS_KEY, useCompressedOops)
+ val initialize = PrivateMethod[Unit](Symbol("initialize"))
+ SizeEstimator invokePrivate initialize()
+ }
+
override def beforeEach(): Unit = {
super.beforeEach()
// Set the arch to 64-bit and compressedOops to true to get a
deterministic test-case
- System.setProperty("os.arch", "amd64")
- val initialize = PrivateMethod[Unit](Symbol("initialize"))
- SizeEstimator invokePrivate initialize()
+ reinitializeSizeEstimator("amd64", "true")
Review comment:
Should this second arg be true here? Some tests that don't set this
currently now set it to true, some to false.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]