don't stop believing

Smartphone Test Farm - STF 설치 (on Ubuntu) 본문

Tools/STF

Smartphone Test Farm - STF 설치 (on Ubuntu)

Tongchun 2019. 3. 25. 17:31

Smartphone Test Farm을 설치해 보겠습니다.

STF는 Open Source로 배포되는 Android Device Farm 입니다.

https://openstf.io/



시작해 보겠습니다.

먼저 Ubuntu 버전부터 확인하고 가겠습니다.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

Ubuntu 버전은 18.04.2 LTS 입니다.


RethinkDB를 설치합니다.

RethinkDB에 대한 정보는 아래 링크에서 확인할 수 있습니다. RethinkDB는 바이너리로 설치합니다.

https://www.rethinkdb.com/docs/install/


apt-get으로 설치할 수 있도록 Repository list에 RethinkDB를 추가합니다.

$ source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list

그리고 RethinkDB key를 추가합니다.

$ sudo wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -

이제 apt-get을 업데이트 해주고 RethinkDB를 설치합니다.

$ sudo apt-get update
Hit:1 http://kr.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                    
Hit:3 http://kr.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                  
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                           
Ign:5 http://download.rethinkdb.com/apt bionic InRelease                                                   
Err:6 http://download.rethinkdb.com/apt bionic Release   
  404  Not Found [IP: 72.14.189.19 80]
Reading package lists... Done       
E: The repository 'http://download.rethinkdb.com/apt bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

예상하지 못할 결과가 나왔습니다.

rethinkDB 의 버전 중 bionic Release를 찾을 수 없다고 나옵니다.

찾아보니 rethinkDB의 몇몇 버전은 바이너리 버전이 공식 배포되어 있지 않습니다.

Ubuntu 18.04의 codename이 bionic인 버전이 그렇습니다.

아래 링크에서 다운받아 설치할 수 있다고 합니다.

https://github.com/srh/rethinkdb/releases/tag/v2.3.6.srh.1


만약 apt-get update가 문제 없다면 sudo apt-get install rethinkdb로 설치할 수 있습니다.


우리는 비공식?으로 배포된 버전을 다운로드 받아 설치하겠습니다.

Downloads 폴더로 이동하고 위 링크에 있는 rethinkdb-dbg_2.3.6.srh.1.0bionic_amd64.deb를 다운받습니다.

$ cd ~/Downloads
$ sudo wget https://github.com/srh/rethinkdb/releases/download/v2.3.6.srh.1/rethinkdb_2.3.6.srh.1.0bionic_amd64.deb

rethinkdb_2.3.6.srh.1.0bionic_amd64.deb 파일이 다운받아 졌다면 dpkg로 설치합니다.

sudo dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb 

$ sudo dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb 
Selecting previously unselected package rethinkdb.
(Reading database ... 164477 files and directories currently installed.)
Preparing to unpack rethinkdb_2.3.6.srh.1.0bionic_amd64.deb ...
Unpacking rethinkdb (2.3.6.srh.1~0bionic) ...
dpkg: dependency problems prevent configuration of rethinkdb:
 rethinkdb depends on libcurl4 (>= 7.16.2); however:
  Package libcurl4 is not installed.

dpkg: error processing package rethinkdb (--install):
 dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10.3) ...
Processing triggers for man-db (2.8.3-2) ...
Errors were encountered while processing:
 rethinkdb

여기서도 에러가 보입니다. 

dpkg: dependency problems prevent configuration of rethinkdb:

 rethinkdb depends on libcurl4 (>= 7.16.2); however:

  Package libcurl4 is not installed.

dependency 에러입니다. 다운로드 페이지에 설명한 데로 sudo apt-get install -f 명령을 실행합니다.

apt-get에서 -f flag는 dependency와 관련된 문제를 해결해 줍니다.

-f, --fix-broken

Fix. Attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. Any package(s) that are specified must completely correct the problem. This option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention. Use of this option together with -m may produce an error in some situations.

$ sudo apt-get install -f

명령을 실행하면 앞서 실행한 sudo dpkg -i 명령에서 rethinkdb와 dependency가 있는 패키지들을 설치하고 RethinkDB도 설치가 완료됩니다.

RethinkDB가 설치되었다면 버전을 확인해 보겠습니다.

$ rethinkdb --version
rethinkdb 2.3.6.srh.1~0bionic (CLANG 6.0.0 (tags/RELEASE_600/final))

앞서 repository에 추가했던 rethinkdb.list 파일은 삭제하겠습니다.

$ sudo rm /etc/apt/sources.list.d/rethinkdb.list


이번에는 STF 실행에 필요한 Package들을 모두 설치해 줍니다.

apt-get을 업데이트 한번 해주고 필요한 package들을 모두 설치해 줍니다.

$ sudo apt-get update
$ sudo apt-get install -y git nodejs npm rethinkdb android-tools-adb python autoconf automake libtool build-essential ninja-build libzmq3-dev libprotobuf-dev git graphicsmagick yasm stow

npm을 통해 추가 package를 설치합니다.

$ sudo npm install -g bower karma gulp

npm으로 package 설치 후 몇 개의 warning이 있어도 문제는 없습니다.

npm WARN optional Skipping failed optional dependency /gulp/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.7

npm WARN optional Skipping failed optional dependency /karma/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.7



이번에는 zeroMQ를 설치합니다.

zeroMQ는 STF에서 비동기 통신에 사용하는 라이브러리 입니다.

http://zeromq.org/

source를 받아 빌드 해 설치해야 합니다.

먼저 Downloads 폴더로 이동해 zeromq를 다운받습니다. 현제 버전은 4.3.1 입니다.

https://github.com/zeromq/libzmq/releases

$ cd ~/Downloads
$ sudo wget https://github.com/zeromq/libzmq/releases/download/v4.3.1/zeromq-4.3.1.tar.gz

압축을 풀고 폴더로 이동합니다.

$ tar -zxvf zeromq-4.3.1.tar.gz
$ cd zeromq-4.3.1

빌드하기 전 config를 설정합니다.

$ ./configure --without-libsodium --prefix=/usr/local/stow/zeromq-4.3.1

빌드(make)를 하고 설치합니다.

$ make
$ sudo make install

source로 설치된 package를 관리하기 위해 stow에 설정합니다.

$ cd /usr/local/stow
$ sudo stow -vv zeromq-4.3.1


Google protobuf를 설치할 차례입니다.

git에서 source를 다운받아 설치하겠습니다.

다운로드 후 autogen과 config 설정, 그리고 make와 설치, stow 설정의 순서로 진행됩니다.

$ cd ~/Downloads
$ git clone https://github.com/google/protobuf.git
$ cd protobuf
$ ./autogen.sh
$ ./configure --prefix=/usr/local/stow/protobuf-`git rev-parse --short HEAD`
$ make
$ sudo make install
$ cd /usr/local/stow
$ sudo stow -vv protobuf-*


library path를 업데이트 합니다.

설치된 library 경로를 업데이트 해 줍니다.

현재 catch에 있는 library를 확인하려면 ldconfig -v | head 명령으로 확인할 수 있습니다.

What is ldconfig?

ldconfig is used to create, udpate and remove symbolic links for the current shared libraries based on the lib directories present in the /etc/ld.so.conf

$ sudo ldconfig


이제 OpenSTF를 설치 합니다.

home 디렉토리로 이동해 OpenSTF라고 폴더를 만들어 줍니다. 그리고 해당 폴더 안에 git에 있는 STF를 다운받습니다.

stf 설치는 npm으로 합니다.

$ cd ~
$ sudo mkdir openstf
$ cd openstf/
$ sudo git clone https://github.com/openstf/stf.git
$ cd stf
$ sudo npm install -g stf --unsafe-perm


STF를 실행합니다.

stf를 실행하려면 rethinkdb와 adb를 먼저 실행해야 합니다.

rethinkdb는 백그라운드로 실행해 줍니다.

$ sudo rethinkdb &
$ sudo adb start-server

실행이 잘 되었는지 ps 명령으로 확인해 봅니다.

$ ps -ef | grep rethinkdb
$ ps -ef | grep adb

rethinkdb와 adb의 process가 잘 떠 있는게 보입니다.


드디어 STF를 실행합니다.

stf local 명령에 --public-ip 플레그를 두고 현재 서버의 ip를 설정합니다.

$ sudo stf local --public-ip 10.10.1.54

STF의 포트는 7100입니다.

브라우저를 열고 서버 IP에 7100 포트로 여결합니다.

이름과 이메일을 입력하고 Log in 버튼을 클릭합니다.

이름과 이메일은 아무거나 입력해도 됩니다.

아직 디바이스가 연결되지 않아 모두 0으로 보이고 있습니다.

아무거나 하나 USB로 연결해 보겠습니다.


스마트폰을 STF가 설치된 PC에 USB로 연결하면 UBS 디버깅을 허용할까요? 라고 묻습니다.

이 컴퓨터에서 항상 허용을 체크하고 확인을 누르면 STF가 디바이스를 인식하게 됩니다.

LG-F800K를 선택해 봅니다. 이건 LG V20 입니다.

LG V20의 화면이 보입니다.

여기서 디바이스를 컨트롤 할 수 있습니다.


여기까지 STF 설치와 디바이스 연결이었습니다.


'Tools > STF' 카테고리의 다른 글

STF 실행 에러 (rethinkdb 관련)  (0) 2019.03.29
STF 백그라운드 실행 (nohup)  (0) 2019.03.27
STF 외부 접속 (Port Forwarding)  (0) 2019.03.27
STF 와 LDAP 연동  (4) 2019.03.27
Comments