Skip to content

Commit 87c4bed

Browse files
committed
trying setting up docker
1 parent 1ec7d23 commit 87c4bed

4 files changed

Lines changed: 97 additions & 11 deletions

File tree

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,51 @@ To use EMB, you need to clone this repository:
117117
git clone https://github.com/EMResearch/EMB.git
118118
```
119119

120-
There are 2 use cases for EMB:
120+
There are 2 main use cases for EMB:
121121

122122
* Run experiments with _EvoMaster_
123123

124124
* Run experiments with other tools
125125

126-
To run experiments with _EvoMaster_, everything can be setup by running the script `scripts/dist.py`.
126+
Everything can be setup by running the script `scripts/dist.py`.
127127
Note that you will need installed at least JDK 8, JDK 11, NPM and .Net 3.x, as well as Docker.
128128
Also, you will need to setup environment variables like `JAVA_HOME_8` and `JAVA_HOME_11`.
129129
The script will issue error messages if any prerequisite is missing.
130-
Once the script is completed, all the SUTs will be available under the `dist` folder, and a `dist.zip` will be created as well.
131-
Note that here the drivers will be built as well besides the SUTs, and the SUT themselves will be instrumented by code manipulations (for white-box testing heuristics) of _EvoMaster_ (this is for JavaScript and .Net, whereas instrumentation for JVM is done at runtime, via an attached JavaAgent).
130+
Once the script is completed, all the SUTs will be available under the `dist` folder, and a `dist.zip` will be created as well (if `scripts/dist.py` is run with `True` as input).
131+
132+
[//]: # (There is also a Docker file to run `dist.py`, named `build.dockerfile`.)
133+
134+
[//]: # (It can be built with:)
135+
136+
[//]: # ()
137+
[//]: # (```)
138+
139+
[//]: # (docker build -f build.dockerfile -t emb .)
140+
141+
[//]: # (```)
142+
143+
[//]: # ()
144+
[//]: # (The `dist` folder with all SUTs will be under `/emb/dist`. )
145+
146+
147+
148+
Note that here the drivers will be built as well besides the SUTs, and the SUT themselves will also have an instrumented version (for white-box testing heuristics) for _EvoMaster_ (this is for JavaScript and .Net, whereas instrumentation for JVM is done at runtime, via an attached JavaAgent).
149+
150+
In the built `dist` folder, the files will be organized as follows:
151+
152+
* For JVM: `<name>-sut.jar` will be the non-instrumented SUTs, whereas their executable drivers will be called `<name>-evomaster-runner.jar`.
153+
Instrumentation can be done at runtime by attaching the `evomaster-agent.jar` JavaAgent. If you are running experiments with EvoMaster, this will be automatically attached when running experiments with `exp.py` (available in the EvoMaster's repository). Or it can be attached manually with JVM option `-Devomaster.instrumentation.jar.path=evomaster-agent.jar` when starting the driver.
154+
* For NodeJS: under the folder `<name>` (for each NodeJS SUT), the SUT is available under `src`, whereas the instrumented version is under `build`.
155+
* For .Net: currently only the instrumented version is available (WORK IN PROGRESS)
156+
157+
132158

133159
For running experiments with EvoMaster, you can also "start" each driver directly from an IDE (e.g., IntelliJ).
134160
Each of these drivers has a "main" method that is running a REST API (binding on default port 40100), where each operation (like start/stop/reset the SUT) can be called via an HTTP message by EvoMaster.
135161
For JavaScript, you need to use the files `em-main.js`.
136162

137163

138-
For using EMB in other contexts besides EvoMaster, you can build (and install) each module separately, based on needs.
164+
You can also build (and install) each module separately, based on needs.
139165
For example, a Maven module can be installed with:
140166

141167
``mvn clean install -DskipTests``

build.dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
### TODO currently not working
2+
3+
FROM python:3.10
4+
5+
RUN apt-get update
6+
RUN apt-get install -y software-properties-common
7+
8+
# https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/generic-linux-install.html
9+
RUN wget -O- https://apt.corretto.aws/corretto.key | apt-key add -
10+
RUN add-apt-repository 'deb https://apt.corretto.aws stable main'
11+
12+
#https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian
13+
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
14+
RUN dpkg -i packages-microsoft-prod.deb
15+
RUN rm packages-microsoft-prod.deb
16+
RUN apt-get install -y apt-transport-https
17+
18+
RUN apt-get update
19+
RUN apt-get install -y dotnet-sdk-3.1 maven java-1.8.0-amazon-corretto-jdk java-11-amazon-corretto-jdk
20+
#ca-certificates-java
21+
RUN apt-get clean
22+
#RUN update-ca-certificates -f
23+
24+
# https://github.com/nodesource/distributions/blob/master/README.md
25+
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
26+
RUN apt-get install -y nodejs
27+
28+
29+
ENV JAVA_HOME_8 /usr/lib/jvm/java-1.8.0-amazon-corretto
30+
RUN export JAVA_HOME_8
31+
ENV JAVA_HOME_11 /usr/lib/jvm/java-11-amazon-corretto
32+
RUN export JAVA_HOME_11
33+
34+
WORKDIR /emb
35+
36+
COPY dotnet_3 dotnet_3
37+
COPY jdk_8_maven jdk_8_maven
38+
COPY jdk_11_maven jdk_11_maven
39+
COPY jdk_11_gradle jdk_11_gradle
40+
COPY js_npm js_npm
41+
COPY scripts scripts
42+
43+
### Currently failing due to SNAPSHOT dependencies and link to client-js
44+
#RUN python3 scripts/dist.py
45+
46+
CMD ["bash"]
47+
48+
49+
# export DOCKER_BUILDKIT=0
50+
# docker build -f build.dockerfile -t emb .
51+
# docker run --entrypoint bash -it emb

jdk_8_maven/cs/rest/original/languagetool/languagetool-core/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
<plugin>
4343
<artifactId>maven-surefire-plugin</artifactId>
4444
</plugin>
45-
<plugin>
46-
<groupId>pl.project13.maven</groupId>
47-
<artifactId>git-commit-id-plugin</artifactId>
48-
</plugin>
45+
<!--? This gives issue... as requires a Git folder, and can have sidee-effects-->
46+
<!--? <plugin>-->
47+
<!--? <groupId>pl.project13.maven</groupId>-->
48+
<!--? <artifactId>git-commit-id-plugin</artifactId>-->
49+
<!--? </plugin>-->
4950
<plugin>
5051
<groupId>org.apache.maven.plugins</groupId>
5152
<artifactId>maven-jar-plugin</artifactId>

scripts/dist.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
EVOMASTER_VERSION = "1.3.1-SNAPSHOT"
44

5+
6+
import sys
57
import os
68
import shutil
79
import platform
@@ -11,6 +13,12 @@
1113
from os.path import expanduser
1214

1315

16+
MAKE_ZIP = False
17+
18+
if len(sys.argv) > 1:
19+
MAKE_ZIP = sys.argv[1] == "true" or sys.argv[1] == "True"
20+
21+
1422
### Environment variables ###
1523

1624
HOME = expanduser("~")
@@ -170,7 +178,6 @@ def buildJS(path, name):
170178

171179
####################
172180
def build_js_npm():
173-
### Due to the insanity of node_modules, those are off by default
174181
buildJS(os.path.abspath(os.path.join(PROJ_LOCATION, "js_npm","rest","ncs")), "js-rest-ncs")
175182
buildJS(os.path.abspath(os.path.join(PROJ_LOCATION, "js_npm","rest","scs")), "js-rest-scs")
176183
buildJS(os.path.abspath(os.path.join(PROJ_LOCATION, "js_npm","rest","cyclotron")), "cyclotron")
@@ -243,7 +250,8 @@ def makeZip():
243250

244251
copyEvoMasterAgent()
245252

246-
makeZip()
253+
if MAKE_ZIP:
254+
makeZip()
247255

248256
######################################################################################
249257
## If we arrive here, it means everything worked fine, with no exception

0 commit comments

Comments
 (0)