diff --git a/Ghidra/Features/GhidraServer/build.gradle b/Ghidra/Features/GhidraServer/build.gradle index 1f5a16c73e..f695e257a8 100644 --- a/Ghidra/Features/GhidraServer/build.gradle +++ b/Ghidra/Features/GhidraServer/build.gradle @@ -109,6 +109,9 @@ rootProject.assembleDistribution { with yajswCopySpec from generateGhidraServerClasspath } + into (getZipPath(this.project) + "/os") { + from (projectDir.toString() + "/os") + } } /********************************************************************************* diff --git a/Ghidra/Features/GhidraServer/certification.manifest b/Ghidra/Features/GhidraServer/certification.manifest index 2aca82db85..004e0b7c13 100644 --- a/Ghidra/Features/GhidraServer/certification.manifest +++ b/Ghidra/Features/GhidraServer/certification.manifest @@ -5,6 +5,5 @@ Module.manifest||GHIDRA||||END| build.gradle||GHIDRA||||END| data/jaas-modules-src-1.0.3.zip||LGPL 2.1|||File corresponds to original distribution with all binary product files removed.|END| -data/lib/readme.txt||GHIDRA||||END| -data/os/readme.txt||GHIDRA||||END| +os/readme.txt||GHIDRA||||END| src/main/java/ghidra/server/remote/ServerHelp.txt||GHIDRA||||END| diff --git a/Ghidra/Features/GhidraServer/data/lib/readme.txt b/Ghidra/Features/GhidraServer/data/lib/readme.txt deleted file mode 100644 index 1f5043b8e8..0000000000 --- a/Ghidra/Features/GhidraServer/data/lib/readme.txt +++ /dev/null @@ -1 +0,0 @@ -This directory is for additional JAVA libraries (*.jar) that you want to make available to GhidraServer. diff --git a/Ghidra/Features/GhidraServer/data/os/readme.txt b/Ghidra/Features/GhidraServer/os/readme.txt similarity index 100% rename from Ghidra/Features/GhidraServer/data/os/readme.txt rename to Ghidra/Features/GhidraServer/os/readme.txt diff --git a/Ghidra/Framework/Generic/src/test/java/ghidra/util/timer/WatchdogTest.java b/Ghidra/Framework/Generic/src/test/java/ghidra/util/timer/WatchdogTest.java new file mode 100644 index 0000000000..c04192b862 --- /dev/null +++ b/Ghidra/Framework/Generic/src/test/java/ghidra/util/timer/WatchdogTest.java @@ -0,0 +1,65 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.util.timer; + +import static org.junit.Assert.*; + +import java.util.concurrent.atomic.AtomicBoolean; + +import org.junit.Test; + +import generic.test.AbstractGTest; +import ghidra.util.Msg; +import ghidra.util.timer.Watchdog; + +public class WatchdogTest extends AbstractGTest { + + @Test(timeout = 20000) + public void test() { + long watchdogTimeoutMS = 10; + + // watchdog could take N*2 to trigger + long watchdogMaxIntrMS = watchdogTimeoutMS * 3; + AtomicBoolean inerruptedFlag = new AtomicBoolean(); + + Thread testThread = Thread.currentThread(); + try (Watchdog watchDog = new Watchdog(watchdogTimeoutMS, () -> { + Msg.trace(this, "" + System.currentTimeMillis() + ": Interrupting the test thread..."); + inerruptedFlag.set(true); + testThread.interrupt(); + })) { + + for (int i = 0; i < 10; i++) { + inerruptedFlag.set(false); + watchDog.arm(); + long start = System.currentTimeMillis(); + try { + Thread.sleep(DEFAULT_WAIT_TIMEOUT); + fail(System.currentTimeMillis() + ": Watchdog did not fire"); + } + catch (InterruptedException e) { + assertTrue("" + System.currentTimeMillis() + + ": Sleep was interrupted, but not by watchdog", inerruptedFlag.get()); + long elapsed = System.currentTimeMillis() - start; + Msg.trace(this, System.currentTimeMillis() + ": Watchdog fired in: " + elapsed + + "ms, max target is: " + watchdogMaxIntrMS + "ms"); + } + } + } + + } + +}