Skip to content

Commit 388b882

Browse files
committed
add code and datasets
1 parent b5024ba commit 388b882

File tree

184 files changed

+1288752
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+1288752
-0
lines changed

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 xlab-uiuc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

core/ADDING_NEW_PROJECT.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
# Adding New Project
3+
4+
If you want to add a new project into the `openctest` framework. You need to do the following steps.
5+
6+
## 1. Instrument Target Project
7+
8+
9+
**Because intercepting and logging the configuration APIs are for two independent purposes -- and their outcome are independent of each other, it is **highly recommended** to create a separate Git branch for each case.**
10+
11+
### 1.1 Intercept Configuration API (Paper Section 4.1)
12+
13+
Intercept the configuration API to overwrite configuration values in the final step of configuration loading.
14+
15+
Specifically, create empty configuration file(s) in the project directory, and make sure the configuration API reads it in the final step of configuration loading. So when the test reads configuration values from the APIs, the values come from the configurations maintained by the ctest infrastructure.
16+
17+
Intercept example in Hadoop:
18+
- [override configuration loading](https://github.com/xlab-uiuc/hadoop/commit/72a9e108e4c2bed13b43d8b4fbd3aa32e690447c#diff-16e961a312f55e9abdc96aa97dec8b284b79ab6d10ca6f2332c66a3f8aa96529)
19+
- [the configuration file created for overriding](https://github.com/xlab-uiuc/hadoop/commit/72a9e108e4c2bed13b43d8b4fbd3aa32e690447c#diff-ad606c23074a9dff0050b0e57746fa6865c2151bcf940fda692d540dfde9b74f)
20+
21+
*This instrumentation is for generating and running ctests, and is needed by the `generate_ctest` and `run_ctest`.*
22+
23+
### 1.2 Logging Configuration API (Paper Section 4.2)
24+
25+
Identify and instrument the configuration GET and SET APIs which read and write configuration values.
26+
27+
The instrumentation should log the GET and SET API usage on each exercised configuration parameter in a specific format. So the ctest infrastructure can identify the parameters exercised in each test by running the tests and parsing the test logs.
28+
29+
GET instrumentation example: [hadoop-common](https://github.com/xlab-uiuc/hadoop/commit/cd8c6d5a2a11298731355c399a1e563234713e97#diff-16e961a312f55e9abdc96aa97dec8b284b79ab6d10ca6f2332c66a3f8aa96529R1104)
30+
31+
SET instrumentation example: [hadoop-common](https://github.com/xlab-uiuc/hadoop/commit/cd8c6d5a2a11298731355c399a1e563234713e97#diff-16e961a312f55e9abdc96aa97dec8b284b79ab6d10ca6f2332c66a3f8aa96529R1275)
32+
33+
*This instrumentation is for identifying parameters exercised by tests, and is needed by `identify_param`.*
34+
35+
36+
## 2. Add Supporting Code in `openctest`
37+
38+
### *2.0 Modify Maven pom.xml
39+
40+
The `maven-surefire-plugin` controls how the testing result is generated. Errors may be caused by discrepancies in the plugin version or test report format. It is important to ensure all supporting projects at least use the same plugin version. To do so, please modify the `pom.xml` in new project.
41+
42+
Sometimes, the locations that need to be changed maybe in multiple `pom` files. For example, for supporting project `hadoop-common`:
43+
- `maven-surefire-plugin` version in [hadoop-common-project/hadoop-common/pom.xml](https://github.com/xlab-uiuc/hadoop/commit/cd8c6d5a2a11298731355c399a1e563234713e97#diff-32126fb088c541b420c68ba15eacf1f1a78d842f71595ba9ed1cbf25c530fa07 "hadoop-common-project/hadoop-common/pom.xml")
44+
- `maven-surefire-plugin` report format in [pom.xml](https://github.com/xlab-uiuc/hadoop/commit/72a9e108e4c2bed13b43d8b4fbd3aa32e690447c#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8 "pom.xml")
45+
46+
### 2.1 Collect Configuration Parameters and Tests
47+
48+
*First*, collect the name, default value (empty if no default value) and description of each configuration parameters in the project. Store the information in a `tsv` file in `default_configs`. For example: [hadoop-common-default.tsv](https://github.com/xlab-uiuc/openctest/blob/master/core/default_configs/hadoop-common-default.tsv).
49+
50+
*Second*, collect the list of configuration parameter names and put them in `openctest/core/identify_param/results/<project>/conf_params.list`.
51+
52+
*Third*, collect the list of exsiting tests in the project in the format of `testClass#testCase`. Put them in `openctest/core/identify_param/results/<project>/test_method_list.json`
53+
54+
55+
### 2.2 Collect Deprecated Configuration Parameters
56+
57+
Collect a mapping from the deprecated parameter name to the new parameter name. Store the information in a `tsv` file in `deprecated_configs`. The format should be the deprecated parameter name followed by the new parameter name. For example: [hadoop.list](https://github.com/xlab-uiuc/openctest/blob/master/core/deprecated_configs/hadoop.list "hadoop.list")
58+
59+
60+
### 2.3 Automate Project Installation
61+
62+
*First*, in `add_project.sh`, add a bash function for cloning, installing, and building the instrumented new project. And it should also automatically switch to the branch with instrumented code for *1.1 Intercept Configuration API*.
63+
64+
Example for the `hadoop-common` module in Hadoop:
65+
66+
```Bash
67+
function setup_hadoop() {
68+
[ ! -d "app/ctest-hadoop" ] && git clone git@github.com:xlab-uiuc/hadoop.git app/ctest-hadoop
69+
cd app/ctest-hadoop
70+
git fetch && git checkout ctest-logging
71+
home_dir=$PWD
72+
cd $home_dir/hadoop-common-project/hadoop-common
73+
mvn clean install -DskipTests
74+
cd $home_dir/hadoop-hdfs-project/hadoop-hdfs-client
75+
mvn clean install -DskipTests
76+
cd $home_dir/hadoop-hdfs-project/hadoop-hdfs
77+
mvn package -DskipTests
78+
}
79+
```
80+
81+
*Second*, in `identify_param/add_project.sh`, add a bash function for cloning, installing, and building the instrumented new project. And it should also automatically switch to the branch with instrumented code for *1.2 Logging Configuration API*.
82+
83+
Using `hadoop-common` as an example, the difference is just:
84+
85+
```Bash
86+
...
87+
git fetch && git checkout ctest-injection
88+
...
89+
```
90+
91+
### 2.3 Add Project Specific Constants
92+
93+
*First*, add project-specific constants to `ctest_const.py` for generating and running ctests. This constant file is used by `generate_ctest` and `run_ctest`. The constants include but not limited to
94+
- project name, like `hadoop-common`, `hadoop-hdfs`, etc
95+
- target project directory
96+
- path(s) to generated surefire report
97+
- path to default configuration parameters file (2.1)
98+
- path to deprecated configuration parameters file (2.2)
99+
- path(s) to configuration files that are used to intercept the configuration API (1.1), like [this](https://github.com/xlab-uiuc/openctest/blob/554fff9c017b99f482da8240f16a000cfd4eb82d/core/ctest_const.py#L82)
100+
101+
*Second*, add project-specific constants to `identify_param/constant.py` for identifying parameters exercised by tests. This constant file is used by `identify_param`.

core/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM openjdk:8
2+
3+
RUN \
4+
apt-get update && \
5+
apt-get install -y software-properties-common && \
6+
# Install Git
7+
apt-get install -y git && \
8+
# Install python
9+
apt-get update && \
10+
apt-get install -y python python-dev python-pip python-virtualenv && \
11+
rm -rf /var/lib/apt/lists/* && \
12+
# Install misc
13+
apt-get update && \
14+
apt-get install -y sudo && \
15+
apt-get install -y vim && \
16+
apt-get install -y wget && \
17+
apt-get install -y zip unzip
18+
19+
RUN \
20+
# Install Maven and other dependencies for supported projects
21+
apt-get update && \
22+
apt-get install -y maven && \
23+
apt-get install -y build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev && \
24+
# Install Protobuf
25+
apt-get update && \
26+
cd /usr/local/src/ && \
27+
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz && \
28+
tar xvf protobuf-2.5.0.tar.gz && \
29+
cd protobuf-2.5.0 && \
30+
./autogen.sh && \
31+
./configure --prefix=/usr && \
32+
make && \
33+
make install
34+
35+
RUN \
36+
useradd -m ctestuser
37+
38+
USER ctestuser
39+
RUN cd /home/ctestuser && \
40+
git clone https://github.com/xlab-uiuc/openctest.git
41+
42+
WORKDIR /home/ctestuser

0 commit comments

Comments
 (0)