Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
@ -1 +0,0 @@
|
||||
4572a27f156b3cba082db187c7712059e99cfd5c SOURCES/4.0.4.tar.gz
|
||||
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@ -1 +1,14 @@
|
||||
SOURCES/4.0.4.tar.gz
|
||||
/byteman-1.5.2-full-clean.tar.gz
|
||||
/byteman-2.0.4.tar.xz
|
||||
/2.1.2.tar.gz
|
||||
/373601b4e608ea622b2fec947824b99cd0edb124.tar.gz
|
||||
/3.0.4.tar.gz
|
||||
/byteman-3.0.4/
|
||||
/3.0.6.tar.gz
|
||||
/byteman-3.0.6/
|
||||
/4.0.2.tar.gz
|
||||
/4.0.3.tar.gz
|
||||
/4.0.4.tar.gz
|
||||
/4.0.5.tar.gz
|
||||
/4.0.15.tar.gz
|
||||
/4.0.16.tar.gz
|
||||
|
||||
@ -14,47 +14,48 @@
|
||||
%global bindir %{homedir}/bin
|
||||
|
||||
Name: byteman
|
||||
Version: 4.0.4
|
||||
Release: 2%{?dist}
|
||||
Version: 4.0.16
|
||||
Release: 20%{?dist}
|
||||
Summary: Java agent-based bytecode injection tool
|
||||
License: LGPLv2+
|
||||
URL: http://www.jboss.org/byteman
|
||||
# wget -O 4.0.4.tar.gz https://github.com/bytemanproject/byteman/archive/4.0.4.tar.gz
|
||||
# wget -O 4.0.16.tar.gz https://github.com/bytemanproject/byteman/archive/4.0.16.tar.gz
|
||||
Source0: https://github.com/bytemanproject/byteman/archive/%{version}.tar.gz
|
||||
|
||||
BuildArch: noarch
|
||||
ExclusiveArch: %{java_arches} noarch
|
||||
|
||||
# Byteman 4.x requires JDK 9+ to build. Require JDK 11 explicitly.
|
||||
BuildRequires: java-11-openjdk-devel
|
||||
# Byteman 4.x requires JDK 9+ to build.
|
||||
BuildRequires: java-devel >= 1:11
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: maven-shade-plugin
|
||||
BuildRequires: maven-source-plugin
|
||||
BuildRequires: maven-plugin-plugin
|
||||
BuildRequires: maven-plugin-bundle
|
||||
BuildRequires: maven-bundle-plugin
|
||||
BuildRequires: maven-assembly-plugin
|
||||
BuildRequires: maven-failsafe-plugin
|
||||
BuildRequires: maven-jar-plugin
|
||||
BuildRequires: maven-surefire-plugin
|
||||
BuildRequires: maven-surefire-provider-testng
|
||||
BuildRequires: maven-surefire-provider-junit
|
||||
BuildRequires: maven-surefire-provider-junit5
|
||||
BuildRequires: maven-verifier-plugin
|
||||
BuildRequires: maven-dependency-plugin
|
||||
BuildRequires: java_cup
|
||||
BuildRequires: jarjar
|
||||
BuildRequires: objectweb-asm
|
||||
BuildRequires: junit
|
||||
BuildRequires: junit5
|
||||
BuildRequires: testng
|
||||
# JBoss modules byteman plugin requires it
|
||||
BuildRequires: mvn(org.jboss.modules:jboss-modules)
|
||||
|
||||
Provides: bundled(objectweb-asm) = 6.2
|
||||
Provides: bundled(java_cup) = 1:0.11b-8
|
||||
Provides: bundled(objectweb-asm) = 9.1
|
||||
Provides: bundled(java_cup) = 1:0.11b-17
|
||||
# We are filtering java-headless >= 1:1.9 requirement. Add
|
||||
# JDK 8 requirement here explicitly which shouldn't match the filter.
|
||||
Requires: java-headless >= 1:1.8
|
||||
|
||||
# Related pieces removed via pom_xpath_remove macros
|
||||
Patch1: remove_submit_integration_test_verification.patch
|
||||
Patch2: testng7_port.patch
|
||||
|
||||
%description
|
||||
Byteman is a tool which simplifies tracing and testing of Java programs.
|
||||
@ -97,10 +98,6 @@ operation of the instrumented methods.
|
||||
%prep
|
||||
%setup -q -n byteman-%{version}
|
||||
|
||||
# Don't use javadoc plugin, use XMvn for javadocs
|
||||
%pom_remove_plugin -r :maven-javadoc-plugin
|
||||
%pom_xpath_remove 'pom:execution[pom:id="make-javadoc-assembly"]' byteman
|
||||
|
||||
# Fix the gid:aid for java_cup
|
||||
sed -i "s|net.sf.squirrel-sql.thirdparty-non-maven|java_cup|" agent/pom.xml
|
||||
sed -i "s|java-cup|java_cup|" agent/pom.xml
|
||||
@ -111,6 +108,7 @@ sed -i "s|java-cup|java_cup|" tests/pom.xml
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit']" agent
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit.compiled']" agent
|
||||
%patch1 -p2
|
||||
%patch2 -p2
|
||||
|
||||
# Remove Submit integration test invocations (tests)
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-failsafe-plugin']/pom:executions/pom:execution[pom:id='submit.TestSubmit']" tests
|
||||
@ -126,20 +124,36 @@ sed -i "s|java-cup|java_cup|" tests/pom.xml
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:executions" contrib/bmunit
|
||||
%pom_xpath_set "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-surefire-plugin']/pom:configuration" '<skip>true</skip>' contrib/bmunit
|
||||
|
||||
# source/target 1.6 is not supported by 17; default is now 1.8
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-compiler-plugin']/pom:configuration/pom:source" pom.xml
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-compiler-plugin']/pom:configuration/pom:target" pom.xml
|
||||
|
||||
# Don't build download, docs modules
|
||||
%pom_disable_module download
|
||||
%pom_disable_module docs
|
||||
|
||||
# Put maven plugin into a separate package
|
||||
# Don't use javadoc plugin, use XMvn for javadocs
|
||||
%pom_remove_plugin -r :maven-javadoc-plugin
|
||||
%pom_remove_dep 'org.apache.maven:maven-project' contrib/rulecheck-maven-plugin
|
||||
%pom_xpath_remove 'pom:execution[pom:id="make-javadoc-assembly"]' byteman
|
||||
|
||||
# Put byteman-rulecheck-maven-plugin into a separate package
|
||||
%mvn_package ":byteman-rulecheck-maven-plugin" rulecheck-maven-plugin
|
||||
|
||||
# CNFE being thrown without this for bmunit5 in rawhide and with tests enabled
|
||||
%pom_add_dep "org.apache.commons:commons-lang3" contrib/bmunit5
|
||||
# Put byteman-bmunit/byteman-dtest into a separate packages since they
|
||||
# runtime require junit
|
||||
%mvn_package ":byteman-bmunit" bmunit
|
||||
%mvn_package ":byteman-dtest" dtest
|
||||
|
||||
%build
|
||||
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
|
||||
%mvn_build
|
||||
export JAVA_HOME=/usr/lib/jvm/java-openjdk
|
||||
# Use --xmvn-javadoc so as to avoid maven-javadoc-plugin issue
|
||||
# (fixed in 3.1.0, fedora has 3.0.1):
|
||||
# See https://issues.apache.org/jira/browse/MJAVADOC-555
|
||||
# https://bugs.openjdk.java.net/browse/JDK-8212233
|
||||
%mvn_build --xmvn-javadoc
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
@ -206,8 +220,112 @@ ln -s %{_javadir}/byteman/byteman.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman.jar
|
||||
%{homedir}/lib/byteman-dtest.jar
|
||||
|
||||
%changelog
|
||||
* Wed Jul 18 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.4-2
|
||||
- Rebuild with java-11-openjdk.
|
||||
* Thu Mar 20 2025 Richard W.M. Jones <rjones@redhat.com> - 4.0.16-20
|
||||
- Update maven-bundle-plugin dependency
|
||||
related: RHEL-83995
|
||||
|
||||
* Thu Dec 12 2024 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-19
|
||||
- Bump release for updated gating tests
|
||||
Related: RHEL-70753
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 4.0.16-18
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 4.0.16-17
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu Jun 13 2024 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-16
|
||||
- Bump release for test run.
|
||||
|
||||
* Thu Jun 13 2024 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-15
|
||||
- Bump release.
|
||||
|
||||
* Sun Mar 03 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 4.0.16-14
|
||||
- Really rebuild with java-21-openjdk as system jdk
|
||||
|
||||
* Tue Feb 27 2024 Jiri Vanek <jvanek@redhat.com> - 4.0.16-13
|
||||
- Rebuilt for java-21-openjdk as system jdk
|
||||
|
||||
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Jul 19 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 4.0.16-10
|
||||
- Build with Java 17
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Wed Aug 10 2022 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-7
|
||||
- Rebuild with latest maven-verifier-plugin
|
||||
|
||||
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Fri Jul 08 2022 Jiri Vanek <jvanek@redhat.com> - 4.0.16-5
|
||||
- Rebuilt for Drop i686 JDKs
|
||||
|
||||
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 4.0.16-4
|
||||
- Rebuilt for java-17-openjdk as system jdk
|
||||
|
||||
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.16-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Fri Jun 18 2021 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.16-1
|
||||
- Update to latest upstream 4.0.16 release.
|
||||
- Drop not-needed jboss-modules BR.
|
||||
|
||||
* Mon May 31 2021 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.15-2
|
||||
- Re-enable tests during build.
|
||||
|
||||
* Mon May 31 2021 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.15-1
|
||||
- Update to latest upstream 4.0.15 release.
|
||||
- Drop tests_pom_xml.patch now included upstream.
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.11-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.11-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 4.0.11-2
|
||||
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
|
||||
|
||||
* Tue Mar 03 2020 Jayashree Huttanagoudar <jhuttana@redhat.com> - 4.0.11-1
|
||||
- Upgrated to latest upstream version 4.0.11
|
||||
- Added a patch to fix rpm build issue caused due to misconfiguration in upstream
|
||||
- Added required additional plugins required for build
|
||||
|
||||
* Tue Jan 28 2020 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-5
|
||||
- Drop not needed BR jarjar. Fixes FTBFS.
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Mon May 06 2019 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-3
|
||||
- Use XMvn javadoc so as to work-around maven-javadoc-plugin issue.
|
||||
- Fixes FTBFS.
|
||||
|
||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Wed Nov 21 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.5-1
|
||||
- Update to latest upstream 4.0.5 release.
|
||||
|
||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Tue Jul 10 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.4-1
|
||||
- Update to latest upstream 4.0.4 release.
|
||||
@ -218,17 +336,16 @@ ln -s %{_javadir}/byteman/byteman.jar $RPM_BUILD_ROOT%{homedir}/lib/byteman.jar
|
||||
- java-headless >= 1:1.9 would get generated, but byteman 4.x
|
||||
runs on JDK 8 too (would even work for JDK 6)
|
||||
|
||||
* Thu Jul 05 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.3-2
|
||||
- Don't use maven-javadoc-plugin. Use XMvn instead.
|
||||
|
||||
* Tue Jul 03 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.3-1
|
||||
- Update to latest upstream 4.0.3 release.
|
||||
|
||||
* Mon Jul 02 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.2-1
|
||||
* Fri Apr 27 2018 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.2-1
|
||||
- Update to latest upstream 4.0.2 release.
|
||||
- Adds support for modular JDKs.
|
||||
|
||||
* Wed May 16 2018 Severin Gehwolf <sgehwolf@redhat.com> - 3.0.6-6
|
||||
- Add maven-javadoc-plugin as BR. Fix versions of bundled
|
||||
libs.
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.6-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||
5
plans/smoke.fmf
Normal file
5
plans/smoke.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
summary: Basic byteman smoke tests
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
||||
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (4.0.16.tar.gz) = e0ec3932b698d07e0543988a944ccdf36533147e056218e0cc92d0ed9695dfaa5066482f493607b16732fcf3c6f5107eefdd7930f6877b747cb21bfecdb737dd
|
||||
22
testng7_port.patch
Normal file
22
testng7_port.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff --git a/byteman-4.0.15/contrib/bmunit/src/org/jboss/byteman/contrib/bmunit/BMNGListener.java b/byteman-4.0.15/contrib/bmunit/src/org/jboss/byteman/contrib/bmunit/BMNGListener.java
|
||||
index 2f784bc..9e4fec9 100644
|
||||
--- a/byteman-4.0.15/contrib/bmunit/src/org/jboss/byteman/contrib/bmunit/BMNGListener.java
|
||||
+++ b/byteman-4.0.15/contrib/bmunit/src/org/jboss/byteman/contrib/bmunit/BMNGListener.java
|
||||
@@ -61,7 +61,7 @@ public class BMNGListener extends BMNGAbstractRunner implements IInvokedMethodLi
|
||||
}
|
||||
|
||||
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
|
||||
- Method javaMethod = method.getTestMethod().getMethod();
|
||||
+ Method javaMethod = method.getTestMethod().getConstructorOrMethod().getMethod();
|
||||
Class clazz = javaMethod.getDeclaringClass();
|
||||
if (!checkBMNGListener(clazz)) {
|
||||
return;
|
||||
@@ -81,7 +81,7 @@ public class BMNGListener extends BMNGAbstractRunner implements IInvokedMethodLi
|
||||
}
|
||||
|
||||
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
|
||||
- Method javaMethod = method.getTestMethod().getMethod();
|
||||
+ Method javaMethod = method.getTestMethod().getConstructorOrMethod().getMethod();
|
||||
Class clazz = javaMethod.getDeclaringClass();
|
||||
if (!checkBMNGListener(clazz)) {
|
||||
return;
|
||||
3
tests/smoke/main.fmf
Normal file
3
tests/smoke/main.fmf
Normal file
@ -0,0 +1,3 @@
|
||||
summary: Basic smoke tests for byteman
|
||||
require: [java-21-openjdk-devel, byteman]
|
||||
test: ./test.sh
|
||||
148
tests/smoke/test.sh
Executable file
148
tests/smoke/test.sh
Executable file
@ -0,0 +1,148 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
set -e
|
||||
|
||||
java --version
|
||||
##############################################################
|
||||
#
|
||||
# Test 1: bmjava
|
||||
#
|
||||
##############################################################
|
||||
test1_dir=$(mktemp -d)
|
||||
pushd $test1_dir
|
||||
#####
|
||||
## The Java program under test (via bmjava)
|
||||
#####
|
||||
cat > HelloWait.java <<EOF1
|
||||
public class HelloWait {
|
||||
|
||||
public static class FooBar {
|
||||
public void doSomething(String arg) {
|
||||
System.out.println("Hello " + arg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
FooBar fooBar = new FooBar();
|
||||
fooBar.doSomething("World!");
|
||||
}
|
||||
|
||||
}
|
||||
EOF1
|
||||
javac -g HelloWait.java
|
||||
#####
|
||||
## The byteman rule (used via bmjava)
|
||||
#####
|
||||
cat > trace1.btm <<EOF2
|
||||
RULE trace doSomething entry
|
||||
CLASS HelloWait\$FooBar
|
||||
METHOD doSomething(java.lang.String)
|
||||
AT ENTRY
|
||||
IF true
|
||||
DO
|
||||
traceln("argument was: " + \$1);
|
||||
\$1 = "bar";
|
||||
ENDRULE
|
||||
EOF2
|
||||
|
||||
bmjava -p 5555 -h 127.0.0.1 -l trace1.btm HelloWait > out1.log
|
||||
grep -q "argument was: World!" out1.log
|
||||
grep -q "Hello bar" out1.log
|
||||
output=$(tail -n1 out1.log)
|
||||
if [ ! "${output}_" == "Hello bar_" ]; then
|
||||
echo Test FAILED!
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Test 1 PASSED!
|
||||
|
||||
popd
|
||||
rm -rf $test1_dir
|
||||
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# Test 2: bminstall + bmsubmit
|
||||
#
|
||||
##############################################################
|
||||
test2_dir=$(mktemp -d)
|
||||
pushd $test2_dir
|
||||
#####
|
||||
## The Java program under test
|
||||
#####
|
||||
cat > HelloWait.java <<EOF3
|
||||
public class HelloWait {
|
||||
|
||||
public static class FooBar {
|
||||
public void doSomething(String arg) {
|
||||
System.out.println("Hello " + arg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
FooBar fooBar = new FooBar();
|
||||
try {
|
||||
while (true) {
|
||||
fooBar.doSomething("World!");
|
||||
Thread.sleep(300);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
EOF3
|
||||
javac -g HelloWait.java
|
||||
java HelloWait > out2.log 2>&1 &
|
||||
pid_of_java=$$
|
||||
echo "Forked java process with pid $pid_of_java"
|
||||
sleep 2
|
||||
#####
|
||||
## The byteman rule(s) (used via bmsubmit)
|
||||
#####
|
||||
cat > change_arg.btm <<EOF4
|
||||
RULE change doSomething arg
|
||||
CLASS HelloWait\$FooBar
|
||||
METHOD doSomething(java.lang.String)
|
||||
AT ENTRY
|
||||
IF true
|
||||
DO
|
||||
\$1 = "THERE!";
|
||||
ENDRULE
|
||||
EOF4
|
||||
cat > throw_excptn.btm <<EOF5
|
||||
RULE throw exception when leaving doSomething
|
||||
CLASS HelloWait\$FooBar
|
||||
METHOD doSomething(java.lang.String)
|
||||
AT EXIT
|
||||
IF true
|
||||
DO
|
||||
THROW new RuntimeException("Boom!")
|
||||
ENDRULE
|
||||
EOF5
|
||||
|
||||
# Install the agent
|
||||
bminstall -p 5555 -h 127.0.0.1 HelloWait
|
||||
# Install the change arg rule
|
||||
bmsubmit -p 5555 -h 127.0.0.1 -l change_arg.btm
|
||||
sleep 2
|
||||
# Unload the change arg rule
|
||||
bmsubmit -p 5555 -h 127.0.0.1 -u change_arg.btm
|
||||
# Install the exception throwing rule
|
||||
bmsubmit -p 5555 -h 127.0.0.1 -l throw_excptn.btm
|
||||
sleep 1
|
||||
|
||||
# Verify the log
|
||||
head -n10 out2.log | grep -q "Hello World!"
|
||||
hello_th_count=$(grep "Hello THERE!" out2.log | wc -l)
|
||||
if [ $hello_th_count -lt 1 ]; then
|
||||
echo "Test 2 FAILED!"
|
||||
exit 1
|
||||
fi
|
||||
grep -q "Boom!" out2.log
|
||||
grep -q "RuntimeException" out2.log
|
||||
echo Test 2 PASSED!
|
||||
|
||||
popd
|
||||
rm -rf $test2_dir
|
||||
Loading…
Reference in New Issue
Block a user