-
Notifications
You must be signed in to change notification settings - Fork 8
TPCP'21 Tutorial Session
This tutorial consists of two parts. In the first part, we will show you how to install and test the application. In the second part we will reduce the demo application that we crafted.
- Clone the repository:
git clone https://github.com/wspr-ncsu/mininode
- Navigate to the mininode/src/ directory:
cd mininode/src
- Install all the dependencies:
npm install
- Install Mininode globally to use it as CLI tool:
npm install -g
- Verify the installation:
mininode --version
We provide test-module/ and test scripts for each of the reduction modes to verify the installation of Mininode. Each script will generate the reduced version of the application under the new folder.
- To build the dependency graph of the test-module without reducing it, run
npm run test:dry
- To reduce the test-module with coarse-grain mode, run
npm run test:coarse
. Coarse-grain mode performs reduction on file-level, i.e. removes only unused files (modules). - To reduce the test-module/ with fine-grain mode, run
npm run test:fine
. Fine-grain mode performs reduction on function level, i.e. removes unused functions from used files.
You can analyze the results of the fine-grain and the coarse-grain reduction modes by navigating to the folders mininode.fine/
and mininode.coarse/
, respectively. The folders were created automatically during the reduction of the test-module application. Notice that both versions deleted unused files (modules), and fine-grain reduction removed unused functions as well.
The demo-app provides two main functionality: (1) removes the specified directory recursively, (2) reads the specified YAML file and prints it out in JSON format.
- Clone the demo application:
git clone https://github.com/igibek/tpcp-demo
- Navigate to the cloned directory:
cd tpcp-demo/
- Install all the dependencies:
npm install
- Create a temporary directory that we are going to delete:
mkdir -p a/b/c/d
- Recursively remove the directory by running: (1)
node main.js --remove ./a
or (2)node remove.js ./a
- Read the provided (or any YAML file) by running: (1)
node main.js --read heroes.yml
or (2)node read.js heroes.yml
- Navigate to the parent directory of the demo-app
- Run mininode in coarse-grain mode:
mininode tpcp-demo/ -d tpcp-coarse/
- Run mininode in fine-grain mode:
mininode tpcp-demo/ -d tpcp-fine --mode fine
- Check the difference using diff:
diff -qyr tpcp-demo tpcp-fine
- Test both reduced version by following the steps above
If you want to keep only one feature (read or remove), you can pass --seeds option with specific file starting from which Mininode will build the dependency tree. For example, if you want to preserve the "read" functionality, run the following: mininode tpcp-demo/ -d tpcp-fine-with-seed -m fine --seeds read.js