Refine the venv setup process. am: da7edd0aa6 am: ce9db403ca am: f6df9bb95a
Original change: https://googleplex-android-review.googlesource.com/c/platform/tools/test/openhst/+/12191405
Change-Id: Ifdba9650c2fe94955953bafe43d06264c64d2345
diff --git a/Makefile b/Makefile
index 4016bab..ed22b8c 100644
--- a/Makefile
+++ b/Makefile
@@ -15,10 +15,10 @@
.PHONY: help start
SHELL := /bin/bash
-SRC_DIR ?= .
-DST_DIR ?= .
-PROTOC_DIR ?= .
-PROTO_SRC_FILE ?= stress_test.proto
+SRC_DIR := .
+DST_DIR := .
+PROTO_SRC_FILE := stress_test.proto
+PROTOC_DIR := ./env
ifeq ($(OS),Windows_NT)
detected_OS := Windows
@@ -29,6 +29,13 @@
ENV_PATH ?= $(shell pwd)
endif
+ifeq ($(detected_OS),Darwin)
+ PROTOC_FILE := protoc-3.11.4-osx-x86_64.zip
+endif
+ifeq ($(detected_OS),Linux)
+ PROTOC_FILE := protoc-3.11.4-linux-x86_64.zip
+endif
+
.DEFAULT: help
help:
@echo "make start"
@@ -40,38 +47,34 @@
start:
ifeq ($(detected_OS),Windows)
- @echo "please install python3 and pytyon3-pip manually"
+ @echo "please install python3.7.5 and pytyon3-pip manually"
py -m pip install --upgrade pip
- py -m pip install --user virtualenv
python -m venv .\env
endif
ifeq ($(detected_OS),Darwin)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
sudo chown -R $(USER_NAME) /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share
chmod u+w /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share
- brew install python3 protobuf sox
- python3 -m pip install --user virtualenv
- python3 -m venv env
+ brew install sox
+ python -m venv env
endif
ifeq ($(detected_OS),Linux)
- sudo apt-get install python3 sox
- sudo apt install python3-pip
- python3 -m pip install --user --upgrade pip
- python3 -m pip install --user virtualenv
- sudo apt-get install python3-venv
- python3 -m venv env
- sudo apt install protobuf-compiler
+ sudo apt-get install sox
+ python -m venv env
endif
proto-compile: ${PROTO_SRC_FILE}
ifeq ($(detected_OS),Windows)
-ifndef PROTOC_DIR
- @echo "Error! Please download protoc.exe from https://github.com/google/protobuf/releases/ and set PROTOC_DIR accordingly"
+ @echo "Download protoc-3.11.4-win64.zip from https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-win64.zip"
+ @echo "Decompress protoc-3.11.4-win64.zip and save proto.exe under env/bin folder"
+ @echo "Decompress protoc-3.11.4-win64.zip and copy include/* under env/include folder"
+ $(PROTOC_DIR)/protoc.exe -I=${SRC_DIR} --proto_path=$(PROTOC_DIR)/include --python_out=${DST_DIR} ${SRC_DIR}/${PROTO_SRC_FILE}
else
- $(PROTOC_DIR)/protoc.exe -I=${SRC_DIR} --python_out=${DST_DIR} ${SRC_DIR}/${PROTO_SRC_FILE}
-endif
-else
- protoc -I=${SRC_DIR} --python_out=${DST_DIR} ${SRC_DIR}/${PROTO_SRC_FILE}
+ curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/$(PROTOC_FILE)
+ sudo unzip -o $(PROTOC_FILE) -d $(PROTOC_DIR) bin/protoc
+ sudo unzip -o $(PROTOC_FILE) -d $(PROTOC_DIR) 'include/*'
+ rm -f $(PROTOC_FILE)
+ $(PROTOC_DIR)/bin/protoc -I=${SRC_DIR} --proto_path=$(PROTOC_DIR)/include --python_out=${DST_DIR} ${SRC_DIR}/${PROTO_SRC_FILE}
endif
clean:
diff --git a/README.md b/README.md
index c4031cd..ea8052f 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,8 @@
* ADB connection between the test server and android handset
* Internet connection on android handset
* No screen lock setting on android handset
-* Python 3.x installed test machine (Linux, Mac, Windows)
+* Install Homebrew (Mac)
+* Install [pyenv](https://github.com/pyenv/pyenv#installation) for Linux and Mac.
* Install GNU make(3.81 above) on test machine (Linux, Mac, Windows)
## Test environment setup
@@ -28,23 +29,37 @@
__Linux & Mac__
+1. pyenv install 3.6.8
+1. pyenv shell 3.6.8
1. make start
-1. make proto-compile
+1. chmod +x ./start_venv.sh
1. source env/bin/activate
1. ./start_venv.sh
+1. make proto-compile
__Windows__
+1. install python3.7.5
1. make start
-1. make proto-compile
1. .\env\Scripts\activate
-1. .\start_venv.bat
1. pip3 install -r requirements.txt
+1. Download [protoc.ext (3.11.4 version)](https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-win64.zip) from [github](https://github.com/protocolbuffers/protobuf/releases/tag/v3.11.4)
+1. Decompress protoc-3.11.4-win64.zip and copy bin/protoc.exe to env/bin folder.
+1. Decompress protoc-3.11.4-win64.zip and copy include/* under env/include folder
+1. make proto-compile
-## Documentation
+## Voice model training
-Read our [detailed documentation](docs/OpenHST.pdf) to learn how to run the
-Hotword Stress Test.
+Before conducting stress test, voice model should be trained with the recorded tts sound.
+
+1. Please follow the guide in "Train voice model" chapter in [OEM Hotword Stress Test with OpenHST](https://docs.google.com/presentation/d/e/2PACX-1vR5kjJfMZGMLMeyFV3AmzgGT1gniS1URztYqv4IJleWiSAtDNYNodsF1FMJHT57duP8CPr5oXvEEqCb/pub?start=false&loop=false&delayms=3000)
+
+## Stress Test
+
+Please refer to the guide in "Run Stress Test" chapter in [OEM Hotword Stress Test with OpenHST](https://docs.google.com/presentation/d/e/2PACX-1vR5kjJfMZGMLMeyFV3AmzgGT1gniS1URztYqv4IJleWiSAtDNYNodsF1FMJHT57duP8CPr5oXvEEqCb/pub?start=false&loop=false&delayms=3000) and run the hotword stress test.
+
+1. python stress_test.py --test_name dsp_trigger_and_screen_off --num_iterations 3000 --output_root test_out
+1. Over 95% pass ratio from 3000 test cycle would be fair enough to declare that the device passed the hotowrd stress test
## Contacts
diff --git a/docs/OpenHST.pdf b/docs/OpenHST.pdf
deleted file mode 100644
index 2b1cb8f..0000000
--- a/docs/OpenHST.pdf
+++ /dev/null
Binary files differ
diff --git a/requirements.txt b/requirements.txt
index a963e06..4f33c0f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,4 @@
google==2.0.3
-protobuf==3.11.3
-protobuf-compiler==1.0.20
absl-py==0.9.0
+protobuf==3.11.3
pexpect==4.8.0