MARSSx86에서 simulation이 끝난 뒤에 메일 전송하기

MARSSx86에서는 simulation이 끝났음을 메일로 알리는 기능을 제공한다. 여러 개의 실험을 동시에 하는 경우에 이 기능을 쓸 수 있다.

1. xoauth.txt 생성
MARSSx86는 xoauth.txt를 생성할 수 있는 툴을 제공한다. (./util/xoauth.py)
아무 인자도 주지 않고 실행하면 사용법을 출력한다.

$python ./util/xoauth.py
Usage: Utilities for XOAUTH authentication.

This script has the following modes of operation:
  --generate_oauth_token
  --generate_xoauth_string
  --test_imap_authentication
  --test_smtp_authentication

The --generate_oauth_token mode will generate and authorize an OAuth token for
testing.

  xoauth --generate_oauth_token --user=xxx@googlemail.com

The script will converse with Google Accounts and generate an oauth request
token, then present you with a URL you should visit in your browser to authorize
the token. Once you get the verification code from the website, enter it into
the script to get your OAuth access token. The output from this command will be
two values: an OAuth token and an OAuth token secret. These values are reusable,so if you save them somewhere you won't have to keep repeating this first step.

The --generate_xoauth_string option generates an XOauth auth string that can
be fed directly to IMAP or SMTP.

(3-legged OAuth)
  xoauth --generate_xoauth_string --user=xxx@googlemail.com
    --oauth_token=k99hfs9dh --oauth_token_secret=sd9fhidfskfj
(2-legged OAuth)
  xoauth --generate_xoauth_string --user=xxx@googlemail.com
    --consumer_key=foo.com --consumer_secret=sd9fhidfskfj
    --xoauth_requestor_id=xxx@googlemail.com
The output of this mode will be a base64-encoded string. To use it, connect to
imap.googlemail.com:993 and pass it as the second argument to the AUTHENTICATE
command.

  a AUTHENTICATE XOAUTH a9sha9sfs[...]9dfja929dk==

The --test_imap_authentication and --test_smtp_authentication comands generate
an XOAUTH string and use them to authenticate to a live IMAP or SMTP server.
You can use the --imap_hostname and --smtp_hostname options to specify the
server to connect to.

  xoauth --test_imap_authentication --user=xxx@googlemail.com
    --oauth_token=k99hfs9dh --oauth_token_secret=sd9fhidfskfj

  xoauth --test_smtp_authentication --user=xxx@googlemail.com
    --oauth_token=k99hfs9dh --oauth_token_secret=sd9fhidfskfj



Options:
  -h, --help            show this help message and exit
  --generate_oauth_token
                        generates an OAuth token for testing
  --generate_xoauth_string
                        generates an initial client response for XOAUTH
  --test_imap_authentication
                        tests authenticating to IMAP with XOAUTH
  --test_smtp_authentication
                        tests authenticating to SMTP with XOAUTH
  --oauth_token=OAUTH_TOKEN
                        (3-legged OAuth) oauth access token
  --oauth_token_secret=OAUTH_TOKEN_SECRET
                        (3-legged OAuth) oauth access token secret
  --xoauth_request_url_base=XOAUTH_REQUEST_URL_BASE
                        request URL for xoauth request
  --user=USER           email address of user for xoauth request
  --scope=SCOPE         scope for the access token. Multiple scopes can be
                        listed separated by spaces with the whole argument
                        quoted.
  --nonce=NONCE         optional nonce for computation. If not supplied, a
                        random value will be used
  --timestamp=TIMESTAMP
                        optional timestamp for computation. If not supplied,
                        the current time will be used.
  --proto=PROTO         The protocol string to embed in the request URL. Valid
                        examples are "imap" and "smtp".
  --xoauth_requestor_id=XOAUTH_REQUESTOR_ID
                        (2-legged OAuth) the xoauth_requestor_id parameter
  --consumer_key=CONSUMER_KEY
                        (2-legged OAuth) The consumer key
  --consumer_secret=CONSUMER_SECRET
                        (2-legged OAuth) The consumer secret
  --imap_hostname=IMAP_HOSTNAME
                        hostname of IMAP service
  --smtp_hostname=SMTP_HOSTNAME
                        hostname of SMTP service
  --output_file=OUTPUT_FILE
                        output file with xoauth information

./util/xoauth.py를 다음의 인자를 주어 실행하면 xoauth.txt를 생성할 수 있다.

$ python ./util/xoauth.py --generate_oauth_token --user=my_email_address@gmail.com
RESPONSE=' oauth_token=XXX&oauth_token_secret=XXX&oauth_callback_confirmed=true '
oauth_token_secret: XXX
oauth_token: XXX
oauth_callback_confirmed: true
To authorize token, visit this url and follow the directions to generate a verification code:
  https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=XXX
Enter verification code: 

링크에 접속하면 다음과 같은 페이지를 볼 수 있다.
MARSSx86 xoauth

인증 코드를 받아 이를 입력해주면 xoauth.txt가 생성된다.

2. ./util/util.cfg 수정
xoauth.txt의 경로를 ./util/util.cfg에 입력한다.

[DEFAULT]
marss_dir = /your/local/marss/directory
util_dir = %(marss_dir)s/util
img_dir = /your/disk/image/dir
qemu_bin = %(marss_dir)s/qemu/qemu-system-x86_64
default_simconfig = -kill-after-run -quiet
 
[email]
xoauth = /path/to/xoauth/xoauth.txt
to = youremail@domain.com
 
[suite spec-int]
checkpoints = gcc, bzip2, sphinx, mcf
 
[run spec-int-ooo]
suite = spec-int
images = %(img_dir)s/spec2006.qcow2
memory = 2G
simconfig = -logfile %(out_dir)s/%(bench)s.log
  -stats %(out_dir)s/%(bench)s.yml
  %(default_simconfig)s
  -machine ooo

3. Simulation 실행
./util/run_bench.py를 사용해 simulation을 할 때 -e 옵션을 주면 된다.

$./util/run_bench.py -d run/spec_int_results -e spec-int-ooo

+덧(2015/05/26)
구글에서 더이상 OAuth 1.0을 지원하지 않는다.
(https://support.google.com/a/answer/6224347?p=oauth)
MARSS의 기본 스크립트로는 메일을 보낼 수 없다.

References :
[1] MARSSx86 – Micro-ARchitectural and System Simulator for x86-based Systems, http://marss86.org/~marss86/index.php/Home
[2] MARSSx86, 허태경, https://gumdaeng.com/2014/12/04/marssx86/
[3] Batch Runs, MARSSx86, http://marss86.org/~marss86/index.php/Batch_Runs

Advertisements
Tagged with: , , , , , ,
Posted in 2) Computer Engineering

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

누적 방문자 수
  • 103,571 hits
%d bloggers like this: