forked from oracle/graal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inspector integration tests with CDT UI.
- Loading branch information
Showing
10 changed files
with
838 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Intergation test of CDT with Inspector backend. | ||
name: Weekly CDT Inspector | ||
|
||
on: | ||
schedule: | ||
# - cron: "30 2 * * 5" # Friday at 2:30 | ||
- cron: "30 12 * * *" | ||
|
||
env: | ||
JAVA_HOME: ${{ github.workspace }}/jdk | ||
JDK_VERSION: "latest" | ||
MX_PATH: ${{ github.workspace }}/mx | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: browser-actions/setup-chrome@v1 | ||
with: | ||
chrome-version: dev | ||
id: setup-chrome | ||
- name: Checkout oracle/graal | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Checkout oracle/graaljs | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: oracle/graaljs | ||
fetch-depth: 1 | ||
sparse-checkout: | | ||
graal-js | ||
- name: Checkout graalvm/mx | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: graalvm/mx.git | ||
fetch-depth: 1 | ||
ref: master | ||
path: ${{ env.MX_PATH }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
- name: Fetch LabsJDK | ||
run: | | ||
mkdir jdk-dl | ||
${MX_PATH}/mx --java-home= fetch-jdk --jdk-id labsjdk-ce-${JDK_VERSION} --to jdk-dl --alias ${JAVA_HOME} | ||
- run: | | ||
echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} | ||
${{ steps.setup-chrome.outputs.chrome-path }} --version | ||
cd ${{ github.workspace }}/graal/vm | ||
${MX_PATH}/mx --dy /tools,graal-js build | ||
cd tests/gh_workflows/CDTInspectorTest | ||
mvn -q compile | ||
mvn -q exec:java -Dexec.args="${{ github.workspace }}/graal/sdk/latest_graalvm_home/bin/js scripts/StepTest.js ${{ steps.setup-chrome.outputs.chrome-path }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.oracle.truffle.tools.chromeinspector.workflowtest</groupId> | ||
<artifactId>CDTInspectorTest</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-api</artifactId> | ||
<version>4.15.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-chrome-driver</artifactId> | ||
<version>4.15.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-support</artifactId> | ||
<version>4.15.0</version> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<exec.mainClass>com.oracle.truffle.tools.chromeinspector.workflowtest.Test</exec.mainClass> | ||
</properties> | ||
</project> |
32 changes: 32 additions & 0 deletions
32
vm/tests/gh_workflows/CDTInspectorTest/scripts/StepTest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. | ||
*/ | ||
|
||
// Finds the count of numbers that are smaller than the provided one. | ||
|
||
var data = [2, 3, 10, 1, 5, 20, 8, 18, 12, 30]; | ||
|
||
function binarySearch(array, element) { | ||
let i1 = 0; | ||
let i2 = array.length - 1; | ||
while (i1 < i2) { | ||
let i = (i1 + i2) >> 1; | ||
let diff = array[i] - element; | ||
if (diff > 0) { | ||
i2 = i; | ||
} else if (diff < 0) { | ||
i1 = i; | ||
} else { | ||
return i; | ||
} | ||
} | ||
return i1; | ||
} | ||
|
||
data = data.sort(function(a,b){return a - b}); | ||
|
||
var index12 = binarySearch(data, 12); | ||
var index8 = binarySearch(data, 8); | ||
print('Index of element 12 is: ' + index12); | ||
print('Index of element 8 is: ' + index8); |
85 changes: 85 additions & 0 deletions
85
vm/tests/gh_workflows/CDTInspectorTest/scripts/StepTest.js.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Opened file: StepTest.js | ||
Stack (1) | ||
:program StepTest.js:8 | ||
Scope (3) | ||
Local | ||
this : Object global{Object: function Object() { | ||
global Global | ||
Stack (1) | ||
:program StepTest.js:27 | ||
Scope (3) | ||
Local | ||
this : Object global{Object: function Object() { | ||
global Global | ||
Stack (1) | ||
:program StepTest.js:29 | ||
Scope (3) | ||
Local | ||
this : Object global{Object: function Object() { | ||
global Global | ||
Stack (2) | ||
binarySearch StepTest.js:11 | ||
:program StepTest.js:29 | ||
Scope (5) | ||
Local | ||
this : Object global{Object: function Object() { | ||
array : \(10\) \[1, 2, 3, 5, 8,.* | ||
element : 12 | ||
global Global | ||
Stack (2) | ||
binarySearch StepTest.js:12 | ||
:program StepTest.js:29 | ||
Scope (6) | ||
Local | ||
this : Object global{Object: function Object() { | ||
array : \(10\) \[1, 2, 3, 5, 8,.* | ||
element : 12 | ||
i1 : 0 | ||
global Global | ||
Stack (2) | ||
binarySearch StepTest.js:13 | ||
:program StepTest.js:29 | ||
Scope (7) | ||
Local | ||
this : Object global{Object: function Object() { | ||
array : \(10\) \[1, 2, 3, 5, 8,.* | ||
element : 12 | ||
i1 : 0 | ||
i2 : 9 | ||
global Global | ||
Stack (2) | ||
binarySearch StepTest.js:16 | ||
:program StepTest.js:29 | ||
Scope (10) | ||
Block | ||
diff : -4 | ||
i : 4 | ||
Local | ||
this : Object global{Object: function Object() { | ||
array : \(10\) \[1, 2, 3, 5, 8,.* | ||
element : 12 | ||
i1 : 0 | ||
i2 : 9 | ||
global Global | ||
Stack (2) | ||
binarySearch StepTest.js:18 | ||
:program StepTest.js:29 | ||
Scope (10) | ||
Block | ||
diff : -4 | ||
i : 4 | ||
Local | ||
this : Object global{Object: function Object() { | ||
array : \(10\) \[1, 2, 3, 5, 8,.* | ||
element : 12 | ||
i1 : 0 | ||
i2 : 9 | ||
global Global | ||
Stack (1) | ||
:program StepTest.js:29 | ||
Scope (3) | ||
Local | ||
this : Object global{Object: function Object() { | ||
global Global | ||
Index of element 12 is: 6 | ||
Index of element 8 is: 4 |
60 changes: 60 additions & 0 deletions
60
...est/src/main/java/com/oracle/truffle/tools/chromeinspector/workflowtest/AbstractTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.oracle.truffle.tools.chromeinspector.workflowtest; | ||
|
||
import java.time.Duration; | ||
import java.util.Objects; | ||
|
||
public abstract class AbstractTest { | ||
|
||
protected static final Duration TIMEOUT = Duration.ofSeconds(5); | ||
|
||
protected static void assertTrue(boolean condition, String message) { | ||
if (!condition) { | ||
fail(message); | ||
} | ||
} | ||
|
||
protected static void assertFalse(boolean condition, String message) { | ||
assertTrue(!condition, message); | ||
} | ||
|
||
protected static void assertNotNull(Object object, String message) { | ||
assertTrue(object != null, message); | ||
} | ||
|
||
protected static void assertEquals(Object expected, Object actual, String message) { | ||
Objects.requireNonNull(expected); | ||
if (expected.equals(actual)) { | ||
return; | ||
} | ||
String cmpMessage = "Expected: '" + expected + "' but was: '" + actual + "'"; | ||
fail(message == null ? cmpMessage : message + " " + cmpMessage); | ||
} | ||
|
||
protected static void fail(String message) { | ||
throw (message != null) ? new AssertionError(message) : new AssertionError(); | ||
} | ||
} |
Oops, something went wrong.