Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
22ba3a3f
Commit
22ba3a3f
authored
12 years ago
by
Shivaram Venkataraman
Browse files
Options
Downloads
Patches
Plain Diff
Add test-cases for 32-bit and no-compressed oops scenarios.
parent
1f68c4b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/test/scala/spark/BoundedMemoryCacheSuite.scala
+4
-1
4 additions, 1 deletion
core/src/test/scala/spark/BoundedMemoryCacheSuite.scala
core/src/test/scala/spark/SizeEstimatorSuite.scala
+42
-13
42 additions, 13 deletions
core/src/test/scala/spark/SizeEstimatorSuite.scala
with
46 additions
and
14 deletions
core/src/test/scala/spark/BoundedMemoryCacheSuite.scala
+
4
−
1
View file @
22ba3a3f
package
spark
package
spark
import
org.scalatest.FunSuite
import
org.scalatest.FunSuite
import
org.scalatest.PrivateMethodTester
class
BoundedMemoryCacheSuite
extends
FunSuite
{
class
BoundedMemoryCacheSuite
extends
FunSuite
with
PrivateMethodTester
{
test
(
"constructor test"
)
{
test
(
"constructor test"
)
{
val
cache
=
new
BoundedMemoryCache
(
60
)
val
cache
=
new
BoundedMemoryCache
(
60
)
expect
(
60
)(
cache
.
getCapacity
)
expect
(
60
)(
cache
.
getCapacity
)
...
@@ -12,6 +13,8 @@ class BoundedMemoryCacheSuite extends FunSuite {
...
@@ -12,6 +13,8 @@ class BoundedMemoryCacheSuite extends FunSuite {
// Set the arch to 64-bit and compressedOops to true to get a deterministic test-case
// Set the arch to 64-bit and compressedOops to true to get a deterministic test-case
val
oldArch
=
System
.
setProperty
(
"os.arch"
,
"amd64"
)
val
oldArch
=
System
.
setProperty
(
"os.arch"
,
"amd64"
)
val
oldOops
=
System
.
setProperty
(
"spark.test.useCompressedOops"
,
"true"
)
val
oldOops
=
System
.
setProperty
(
"spark.test.useCompressedOops"
,
"true"
)
val
initialize
=
PrivateMethod
[
Unit
](
'initialize
)
SizeEstimator
invokePrivate
initialize
()
val
cache
=
new
BoundedMemoryCache
(
60
)
{
val
cache
=
new
BoundedMemoryCache
(
60
)
{
//TODO sorry about this, but there is not better way how to skip 'cacheTracker.dropEntry'
//TODO sorry about this, but there is not better way how to skip 'cacheTracker.dropEntry'
...
...
This diff is collapsed.
Click to expand it.
core/src/test/scala/spark/SizeEstimatorSuite.scala
+
42
−
13
View file @
22ba3a3f
...
@@ -2,6 +2,7 @@ package spark
...
@@ -2,6 +2,7 @@ package spark
import
org.scalatest.FunSuite
import
org.scalatest.FunSuite
import
org.scalatest.BeforeAndAfterAll
import
org.scalatest.BeforeAndAfterAll
import
org.scalatest.PrivateMethodTester
class
DummyClass1
{}
class
DummyClass1
{}
...
@@ -18,7 +19,7 @@ class DummyClass4(val d: DummyClass3) {
...
@@ -18,7 +19,7 @@ class DummyClass4(val d: DummyClass3) {
val
x
:
Int
=
0
val
x
:
Int
=
0
}
}
class
SizeEstimatorSuite
extends
FunSuite
with
BeforeAndAfterAll
{
class
SizeEstimatorSuite
extends
FunSuite
with
BeforeAndAfterAll
with
PrivateMethodTester
{
var
oldArch
:
String
=
_
var
oldArch
:
String
=
_
var
oldOops
:
String
=
_
var
oldOops
:
String
=
_
...
@@ -29,17 +30,8 @@ class SizeEstimatorSuite extends FunSuite with BeforeAndAfterAll {
...
@@ -29,17 +30,8 @@ class SizeEstimatorSuite extends FunSuite with BeforeAndAfterAll {
}
}
override
def
afterAll
()
{
override
def
afterAll
()
{
if
(
oldArch
!=
null
)
{
resetOrClear
(
"os.arch"
,
oldArch
)
System
.
setProperty
(
"os.arch"
,
oldArch
)
resetOrClear
(
"spark.test.useCompressedOops"
,
oldOops
)
}
else
{
System
.
clearProperty
(
"os.arch"
)
}
if
(
oldOops
!=
null
)
{
System
.
setProperty
(
"spark.test.useCompressedOops"
,
oldOops
)
}
else
{
System
.
clearProperty
(
"spark.test.useCompressedOops"
)
}
}
}
test
(
"simple classes"
)
{
test
(
"simple classes"
)
{
...
@@ -99,5 +91,42 @@ class SizeEstimatorSuite extends FunSuite with BeforeAndAfterAll {
...
@@ -99,5 +91,42 @@ class SizeEstimatorSuite extends FunSuite with BeforeAndAfterAll {
assert
(
estimatedSize
>=
4000
,
"Estimated size "
+
estimatedSize
+
" should be more than 4000"
)
assert
(
estimatedSize
>=
4000
,
"Estimated size "
+
estimatedSize
+
" should be more than 4000"
)
assert
(
estimatedSize
<=
4200
,
"Estimated size "
+
estimatedSize
+
" should be less than 4100"
)
assert
(
estimatedSize
<=
4200
,
"Estimated size "
+
estimatedSize
+
" should be less than 4100"
)
}
}
}
test
(
"32-bit arch"
)
{
val
arch
=
System
.
setProperty
(
"os.arch"
,
"x86"
)
val
initialize
=
PrivateMethod
[
Unit
](
'initialize
)
SizeEstimator
invokePrivate
initialize
()
expect
(
40
)(
SizeEstimator
.
estimate
(
""
))
expect
(
48
)(
SizeEstimator
.
estimate
(
"a"
))
expect
(
48
)(
SizeEstimator
.
estimate
(
"ab"
))
expect
(
56
)(
SizeEstimator
.
estimate
(
"abcdefgh"
))
resetOrClear
(
"os.arch"
,
arch
)
}
test
(
"64-bit arch with no compressed oops"
)
{
val
arch
=
System
.
setProperty
(
"os.arch"
,
"amd64"
)
val
oops
=
System
.
setProperty
(
"spark.test.useCompressedOops"
,
"false"
)
val
initialize
=
PrivateMethod
[
Unit
](
'initialize
)
SizeEstimator
invokePrivate
initialize
()
expect
(
64
)(
SizeEstimator
.
estimate
(
""
))
expect
(
72
)(
SizeEstimator
.
estimate
(
"a"
))
expect
(
72
)(
SizeEstimator
.
estimate
(
"ab"
))
expect
(
80
)(
SizeEstimator
.
estimate
(
"abcdefgh"
))
resetOrClear
(
"os.arch"
,
arch
)
resetOrClear
(
"spark.test.useCompressedOops"
,
oops
)
}
def
resetOrClear
(
prop
:
String
,
oldValue
:
String
)
{
if
(
oldValue
!=
null
)
{
System
.
setProperty
(
prop
,
oldValue
)
}
else
{
System
.
clearProperty
(
prop
)
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment