Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
bb678d1f
提交
bb678d1f
authored
1月 19, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch to JaCoCo code coverage
上级
5427bf61
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
120 行增加
和
38 行删除
+120
-38
.gitignore
h2/.gitignore
+1
-0
build.html
h2/src/docsrc/html/build.html
+0
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+19
-20
TestMVStoreBenchmark.java
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
+1
-1
Build.java
h2/src/tools/org/h2/build/Build.java
+99
-16
没有找到文件。
h2/.gitignore
浏览文件 @
bb678d1f
...
...
@@ -4,6 +4,7 @@
.settings
benchmark.html
bin
coverage
data
docs
ext
...
...
h2/src/docsrc/html/build.html
浏览文件 @
bb678d1f
...
...
@@ -63,7 +63,6 @@ To use this database, it is not required to install this software however.
<a
href=
"http://subclipse.tigris.org"
>
Subclipse
</a>
,
<a
href=
"http://eclipse-cs.sourceforge.net"
>
Eclipse Checkstyle Plug-in
</a>
,
<a
href=
"http://www.eclemma.org"
>
EclEmma Java Code Coverage
</a>
</li><li><a
href=
"http://emma.sourceforge.net"
>
Emma Java Code Coverage
</a>
</li><li><a
href=
"http://www.mozilla.com/firefox"
>
Mozilla Firefox
</a>
</li><li><a
href=
"http://www.openoffice.org"
>
OpenOffice
</a>
</li><li><a
href=
"http://nsis.sourceforge.net"
>
NSIS
</a>
(Nullsoft Scriptable Install System)
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
bb678d1f
...
...
@@ -303,11 +303,6 @@ java org.h2.test.TestAll timer
*/
public
boolean
memory
;
/**
* Whether the test is running with code coverage.
*/
public
boolean
coverage
;
/**
* If code coverage is enabled.
*/
...
...
@@ -548,7 +543,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
test
.
testEverything
();
}
else
if
(
"codeCoverage"
.
equals
(
args
[
0
]))
{
test
.
codeCoverage
=
true
;
test
.
run
Tests
();
test
.
run
Coverage
();
}
else
if
(
"multiThread"
.
equals
(
args
[
0
]))
{
new
TestMulti
().
runTest
(
test
);
}
else
if
(
"halt"
.
equals
(
args
[
0
]))
{
...
...
@@ -611,8 +606,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
abbaLockingDetector
=
new
AbbaLockingDetector
().
startCollecting
();
}
coverage
=
isCoverage
();
smallLog
=
big
=
networked
=
memory
=
ssl
=
false
;
diskResult
=
traceSystemOut
=
diskUndo
=
false
;
traceTest
=
stopOnError
=
false
;
...
...
@@ -697,18 +690,24 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
}
}
/**
* Check whether this method is running with "Emma" code coverage turned on.
*
* @return true if the stack trace contains ".emma."
*/
private
static
boolean
isCoverage
()
{
for
(
StackTraceElement
e
:
Thread
.
currentThread
().
getStackTrace
())
{
if
(
e
.
toString
().
contains
(
".emma."
))
{
return
true
;
}
}
return
false
;
private
void
runCoverage
()
throws
SQLException
{
smallLog
=
big
=
networked
=
memory
=
ssl
=
false
;
diskResult
=
traceSystemOut
=
diskUndo
=
false
;
traceTest
=
stopOnError
=
false
;
defrag
=
false
;
traceLevelFile
=
throttle
=
0
;
cipher
=
null
;
memory
=
true
;
multiThreaded
=
true
;
test
();
testUnit
();
multiThreaded
=
false
;
mvStore
=
false
;
mvcc
=
false
;
test
();
// testUnit();
}
/**
...
...
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
浏览文件 @
bb678d1f
...
...
@@ -40,7 +40,7 @@ public class TestMVStoreBenchmark extends TestBase {
if
(!
config
.
big
)
{
return
;
}
if
(
config
.
co
verage
||
config
.
co
deCoverage
)
{
if
(
config
.
codeCoverage
)
{
// run only when _not_ using a code coverage tool,
// because the tool might instrument our code but not
// java.util.*
...
...
h2/src/tools/org/h2/build/Build.java
浏览文件 @
bb678d1f
...
...
@@ -6,15 +6,22 @@
package
org
.
h2
.
build
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.lang.reflect.Method
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
org.h2.build.code.SwitchSource
;
import
org.h2.build.doc.XMLParser
;
...
...
@@ -114,17 +121,67 @@ public class Build extends BuildBase {
javac
(
args
,
files
);
}
private
static
void
copy
(
InputStream
in
,
OutputStream
out
)
throws
IOException
{
byte
[]
buffer
=
new
byte
[
8192
];
int
read
;
while
((
read
=
in
.
read
(
buffer
,
0
,
buffer
.
length
))
>=
0
)
{
out
.
write
(
buffer
,
0
,
read
);
}
}
/**
* Run the
Emma
code coverage.
* Run the
JaCoco
code coverage.
*/
@Description
(
summary
=
"Run the
Emma
code coverage."
)
@Description
(
summary
=
"Run the
JaCoco
code coverage."
)
public
void
coverage
()
{
compile
();
downloadTest
();
downloadUsingMaven
(
"ext/emma-2.0.5312.jar"
,
"emma"
,
"emma"
,
"2.0.5312"
,
"30a40933caf67d88d9e75957950ccf353b181ab7"
);
String
cp
=
"temp"
+
File
.
pathSeparator
+
"bin"
+
File
.
pathSeparator
+
"ext/emma-2.0.5312.jar"
+
downloadUsingMaven
(
"ext/org.jacoco.agent-0.8.0.jar"
,
"org.jacoco"
,
"org.jacoco.agent"
,
"0.8.0"
,
"f2748b949b5fc661e089e2eeef39891dfd10a7e5"
);
try
(
ZipFile
zipFile
=
new
ZipFile
(
new
File
(
"ext/org.jacoco.agent-0.8.0.jar"
)))
{
final
Enumeration
<?
extends
ZipEntry
>
e
=
zipFile
.
entries
();
while
(
e
.
hasMoreElements
())
{
final
ZipEntry
zipEntry
=
e
.
nextElement
();
final
String
name
=
zipEntry
.
getName
();
if
(
name
.
equals
(
"jacocoagent.jar"
))
{
try
(
InputStream
in
=
zipFile
.
getInputStream
(
zipEntry
);
FileOutputStream
out
=
new
FileOutputStream
(
"ext/jacocoagent.jar"
))
{
copy
(
in
,
out
);
}
}
}
}
catch
(
IOException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
downloadUsingMaven
(
"ext/org.jacoco.cli-0.8.0.jar"
,
"org.jacoco"
,
"org.jacoco.cli"
,
"0.8.0"
,
"69e55ba110e6ffa91d72ed3df8e09aecf043b0ab"
);
downloadUsingMaven
(
"ext/org.jacoco.core-0.8.0.jar"
,
"org.jacoco"
,
"org.jacoco.core"
,
"0.8.0"
,
"cc2ebdc1da53665ec788903bad65ee64345e4455"
);
downloadUsingMaven
(
"ext/org.jacoco.report-0.8.0.jar"
,
"org.jacoco"
,
"org.jacoco.report"
,
"0.8.0"
,
"1bcab2a451f5a382bc674857c8f3f6d3fa52151d"
);
downloadUsingMaven
(
"ext/asm-6.1-beta.jar"
,
"org.ow2.asm"
,
"asm"
,
"6.1-beta"
,
"bac2f84e42b7db902103a9ec8c4ca1293223e0ea"
);
downloadUsingMaven
(
"ext/asm-commons-6.1-beta.jar"
,
"org.ow2.asm"
,
"asm-commons"
,
"6.1-beta"
,
"4ec77cde3be41559f92d25cdb39b9c55ee479253"
);
downloadUsingMaven
(
"ext/asm-tree-6.1-beta.jar"
,
"org.ow2.asm"
,
"asm-tree"
,
"6.1-beta"
,
"539d3b0f5f7f5b04b1c286de8e76655b59ab2d43"
);
downloadUsingMaven
(
"ext/args4j-2.33.jar"
,
"args4j"
,
"args4j"
,
"2.33"
,
"bd87a75374a6d6523de82fef51fc3cfe9baf9fc9"
);
delete
(
files
(
"coverage"
));
// Use own copy
copy
(
"coverage/bin"
,
files
(
"temp"
),
"temp"
);
// JaCoCo does not support multiple versions of the same classes
delete
(
files
(
"coverage/bin/META-INF/versions"
));
String
cp
=
"coverage/bin"
+
File
.
pathSeparator
+
"ext/postgresql-9.4.1209.jre6.jar"
+
File
.
pathSeparator
+
"ext/servlet-api-3.1.0.jar"
+
File
.
pathSeparator
+
"ext/lucene-core-3.6.2.jar"
+
...
...
@@ -135,17 +192,43 @@ public class Build extends BuildBase {
File
.
pathSeparator
+
"ext/slf4j-api-1.6.0.jar"
+
File
.
pathSeparator
+
"ext/slf4j-nop-1.6.0.jar"
+
File
.
pathSeparator
+
javaToolsJar
;
//
-XX:-UseSplitVerifier is for Java 7 compatibility
//
Run tests
execJava
(
args
(
"-Xmx128m"
,
"-XX:-UseSplitVerifier"
,
"-cp"
,
cp
,
"emma"
,
"run"
,
"-cp"
,
"temp"
,
"-sp"
,
"src/main"
,
"-r"
,
"html,txt"
,
"-ix"
,
"-org.h2.test.*,-org.h2.dev.*,"
+
"-org.h2.jaqu.*,-org.h2.mode.*,-org.h2.server.pg.*"
,
"org.h2.test.TestAll"
));
"-javaagent:ext/jacocoagent.jar=destfile=coverage/jacoco.exec,"
+
"excludes=org.h2.test.*:org.h2.tools.*:org.h2.sample.*:android.*"
,
"-cp"
,
cp
,
"org.h2.test.TestAll"
,
"codeCoverage"
));
// Remove classes that we don't want to include in report
delete
(
files
(
"coverage/bin/android"
));
delete
(
files
(
"coverage/bin/org/h2/test"
));
delete
(
files
(
"coverage/bin/org/h2/tools"
));
delete
(
files
(
"coverage/bin/org/h2/sample"
));
// Generate report
execJava
(
args
(
"-cp"
,
"ext/org.jacoco.cli-0.8.0.jar"
+
File
.
pathSeparator
+
"ext/org.jacoco.core-0.8.0.jar"
+
File
.
pathSeparator
+
"ext/org.jacoco.report-0.8.0.jar"
+
File
.
pathSeparator
+
"ext/asm-6.1-beta.jar"
+
File
.
pathSeparator
+
"ext/asm-commons-6.1-beta.jar"
+
File
.
pathSeparator
+
"ext/asm-tree-6.1-beta.jar"
+
File
.
pathSeparator
+
"ext/args4j-2.33.jar"
,
"org.jacoco.cli.internal.Main"
,
"report"
,
"coverage/jacoco.exec"
,
"--classfiles"
,
"coverage/bin"
,
"--html"
,
"coverage/report"
,
"--sourcefiles"
,
"h2/src/main"
));
try
{
tryOpenCoverageInBrowser
();
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
private
static
void
tryOpenCoverageInBrowser
()
throws
Exception
{
Class
<?>
desktop
=
Class
.
forName
(
"java.awt.Desktop"
);
Method
m
=
desktop
.
getMethod
(
"getDesktop"
);
Object
d
=
m
.
invoke
(
null
);
m
=
d
.
getClass
().
getMethod
(
"open"
,
File
.
class
);
m
.
invoke
(
d
,
new
File
(
"coverage/report/index.html"
));
}
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论