Skip to content

Commit

Permalink
cmdline tests for -Xtrace:methodstrarglen
Browse files Browse the repository at this point in the history
Closes: eclipse-openj9#16416
Signed-off-by: Nick Kamal <[email protected]>
  • Loading branch information
h3110n3rv3 committed Dec 17, 2024
1 parent 1866b5d commit fe69582
Showing 1 changed file with 55 additions and 20 deletions.
75 changes: 55 additions & 20 deletions test/functional/cmdLineTests/xtraceTests/xtraceTests.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<!--
Copyright IBM Corp. and others 2016
Copyright IBM Corp. and others 2016
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] https://openjdk.org/legal/assembly-exception.html
[1] https://www.gnu.org/software/classpath/license.html
[2] https://openjdk.org/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
-->

<!DOCTYPE suite SYSTEM "cmdlinetester.dtd">

<suite id="xtrace commandline tests" timeout="120">

<!-- These tests check -Xteace is working correctly and error/warning messages are proper. -->
<!-- These tests check -Xtrace is working correctly and error/warning messages are proper. -->

<test id="Test -Xtrace:methods={java/lang/String.concat'()'},methodStrArgLen='a',print=mt ">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat'()'},print=mt -version</command>
<test id="Test 1 - invalid argument - 'a'">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},methodStrArgLen='a',print=mt -version</command>
<output regex="no" type="success">Trace option unrecognized: -Xtrace:methodStrArgLen</output>
<output regex="no" type="required">Error processing trace option, detail: methodstrarglen takes an unsigned integer value from 1 to 128</output>
<output regex="yes" javaUtilPattern="yes" type="required">Error processing trace option, detail: Invalid character(s) encountered in decimal number .?.</output>
<output regex="no" type="required">Error processing trace option, detail: methodstrarglen takes an unsigned integer value from 1 to 128</output>
<output regex="no" type="required">Error processing trace option, detail: Invalid character(s) encountered in decimal number</output>
</test>

<test id="Test 2 - out of range invalid argument - 129">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},methodStrArgLen=129,print=mt -version</command>
<output regex="no" type="success">Trace option unrecognized: -Xtrace:methodStrArgLen</output>
<output regex="no" type="required">Error processing trace option, detail: methodstrarglen takes an unsigned integer value from 1 to 128</output>
<output regex="no" type="required">Error processing trace option: -Xtrace:methodStrArgLen=129</output>
</test>

<test id="Test 3 - valid argument length 1" runPath=".">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},methodStrArgLen=1,print=mt -version</command>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(.)*method arguments: \(\(String\)"(\w)"\.{3}\)</output>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>
</test>


<test id="Test 4 - valid argument length" runPath=".">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},methodStrArgLen=6,print=mt -version</command>

<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(.)*method arguments: \(\(String\)"(\w{6})"\.{3}\)</output>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>
</test>

<test id="Test 5 - out of range invalid argument - 0">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},methodStrArgLen=0,print=mt -version</command>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(.)*method arguments: \(\(String\)"([\x00-\x7F]{0,32})"\)</output>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>
</test>

<test id="Test 5 - no argument">
<command>$EXE$ -Xtrace:methods={java/lang/String.concat()},print=mt -version</command>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(.)*method arguments: \(\(String\)"([\x00-\x7F]{0,32})"\)</output>
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>
</test>


</suite>

0 comments on commit fe69582

Please sign in to comment.