본문으로 바로가기

Xvfb 테스트

category 블로그 (Blog)/개발로그 (Devlogs) 2024. 3. 15. 11:03

Xvfb (X Virtual Frame Buffer)는 디스플레이 하드웨어와 물리적 입력 장치가 없는
기계 상에서 실행되는 X 서버. Xvfb는 가상 메모리를 사용하여 단순 프레임버퍼를
시뮬레이트하며, 어떠한 장치도 열지않고 X 디스플레이처럼 실행됨.
Xvfb는 일반적으로 서버를 테스트하는데 사용됨.

% Xvfb :99 -screen 0 1024x768x24 +extension GLX +render -noreset &
% export DISPLAY=:99
% firefox
% killall Xvfb

 

아래는.. Xvfb 서비스 스크립트 (/etc/init.d/xvfb).

#!/bin/bash
 
XVFB=/usr/bin/Xvfb
XVFBARGS="$DISPLAY -ac -screen 0 1024x768x16"
PIDFILE=${HOME}/xvfb_${DISPLAY:1}.pid
case "$1" in
  start)
    echo -n "Starting virtual X frame buffer: Xvfb"
    /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
    echo "."
    ;;
  stop)
    echo -n "Stopping virtual X frame buffer: Xvfb"
    /sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE
    echo "."
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
  echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
  exit 1
esac
exit 0

 

% export DISPLAY=:99
% service xvfb start
# or /etc/init.d/xvfb start
% service xvfb stop
# or /etc/init.d/xvfb stop


xvfb-run 스크립트는 Xvfb의 wrapper인데..
옵션중 –auto-servernum 를 사용하여 사용가능한 display number를 자동 할당 할 수 있음.

또한.. xvfb-run 수행시 아래의 에러가 발생하면..

xvfb-run: error: Xvfb failed to start
Fatal server error:
Could not create server lock file: /tmp/.X99-lock


아래와 같이 해볼 것.

sudo xvfb-run -e /dev/stdout [mycommand]


사용 가능한 display number 를 찾는 방법.

( http://stackoverflow.com/questions/2520704/find-a-free-x11-display-number)

혹시 몰라.. pdf로도 저장..

Find-a-free-X11-display-number-Stack-Overflow.pdf
0.15MB

 

 

'블로그 (Blog) > 개발로그 (Devlogs)' 카테고리의 다른 글

Enlightenment desktop 기반의 리눅스..  (0) 2024.03.15
CentOS 6.x 에 xpra 설치하기  (0) 2024.03.15
디렉토리 관련 함수들..  (0) 2024.03.15
Simple Dynamic Strings  (0) 2024.03.15
Duktape  (0) 2024.03.15