{"action":"created","comment":{"url":"https://api.github.com/repos/jserv/amacc/pulls/comments/61686911","id":61686911,"diff_hunk":"@@ -0,0 +1,48 @@\n+#!/usr/bin/env python\n+# encoding: utf-8\n+\n+import unittest\n+import subprocess as sp\n+import os\n+\n+qemuCmd = \"qemu-arm -L /usr/arm-linux-gnueabihf\".split()\n+amacc = \"./amacc\"\n+gcc = \"arm-linux-gnueabihf-gcc\"","path":"runtest.py","position":null,"original_position":10,"commit_id":"891abb861076b87a441940eeaf7bce9dd7917152","original_commit_id":"05388380c91d74a344829d81b1f7f487d62474ad","user":{"login":"jserv","id":478921,"avatar_url":"https://avatars.githubusercontent.com/u/478921?v=3","gravatar_id":"","url":"https://api.github.com/users/jserv","html_url":"https://github.com/jserv","followers_url":"https://api.github.com/users/jserv/followers","following_url":"https://api.github.com/users/jserv/following{/other_user}","gists_url":"https://api.github.com/users/jserv/gists{/gist_id}","starred_url":"https://api.github.com/users/jserv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jserv/subscriptions","organizations_url":"https://api.github.com/users/jserv/orgs","repos_url":"https://api.github.com/users/jserv/repos","events_url":"https://api.github.com/users/jserv/events{/privacy}","received_events_url":"https://api.github.com/users/jserv/received_events","type":"User","site_admin":false},"body":"Is there any effective way to avoid hardcode strings?","created_at":"2016-05-01T13:12:22Z","updated_at":"2016-05-01T13:12:22Z","html_url":"https://github.com/jserv/amacc/pull/18#discussion_r61686911","pull_request_url":"https://api.github.com/repos/jserv/amacc/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/jserv/amacc/pulls/comments/61686911"},"html":{"href":"https://github.com/jserv/amacc/pull/18#discussion_r61686911"},"pull_request":{"href":"https://api.github.com/repos/jserv/amacc/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/jserv/amacc/pulls/18","id":68486561,"html_url":"https://github.com/jserv/amacc/pull/18","diff_url":"https://github.com/jserv/amacc/pull/18.diff","patch_url":"https://github.com/jserv/amacc/pull/18.patch","issue_url":"https://api.github.com/repos/jserv/amacc/issues/18","number":18,"state":"open","locked":false,"title":"Add python run test script","user":{"login":"yodalee","id":1913143,"avatar_url":"https://avatars.githubusercontent.com/u/1913143?v=3","gravatar_id":"","url":"https://api.github.com/users/yodalee","html_url":"https://github.com/yodalee","followers_url":"https://api.github.com/users/yodalee/followers","following_url":"https://api.github.com/users/yodalee/following{/other_user}","gists_url":"https://api.github.com/users/yodalee/gists{/gist_id}","starred_url":"https://api.github.com/users/yodalee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yodalee/subscriptions","organizations_url":"https://api.github.com/users/yodalee/orgs","repos_url":"https://api.github.com/users/yodalee/repos","events_url":"https://api.github.com/users/yodalee/events{/privacy}","received_events_url":"https://api.github.com/users/yodalee/received_events","type":"User","site_admin":false},"body":"Add a python script written in python unittest, which will use `arm-linux-gnueabihf-gcc` as correct answer, and test amacc output result. Using this tool I found three testcase cannot passed: char.c, ptr.c, shift.c\r\n```\r\nUsage: ./runtest.py # test every c files in tests directory\r\nor\r\nUsage: ./runtest.py pattern # test files in tests that file name contains pattern\r\nexample: ./runtest.py eq # only run tests/eq.c\r\n```\r\n\r\nCurrently we cannot test against elf output since subprocess cannot get the output of running elf. The problem may cause by that the elf generated by `amacc` doesn't flush the `stdout` buffer before exit. If running in terminal it will be fine since `libc` set stdout to line buffer if `isatty() == 1`, however it prevent we tests it using python subprocess.\r\n\r\n\r\n\r\n\r\n\r\n","created_at":"2016-05-01T04:04:18Z","updated_at":"2016-05-01T13:12:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a89a10f062d2895c12f0e26f363018d5c3e25df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jserv/amacc/pulls/18/commits","review_comments_url":"https://api.github.com/repos/jserv/amacc/pulls/18/comments","review_comment_url":"https://api.github.com/repos/jserv/amacc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jserv/amacc/issues/18/comments","statuses_url":"https://api.github.com/repos/jserv/amacc/statuses/891abb861076b87a441940eeaf7bce9dd7917152","head":{"label":"yodalee:unittest","ref":"unittest","sha":"891abb861076b87a441940eeaf7bce9dd7917152","user":{"login":"yodalee","id":1913143,"avatar_url":"https://avatars.githubusercontent.com/u/1913143?v=3","gravatar_id":"","url":"https://api.github.com/users/yodalee","html_url":"https://github.com/yodalee","followers_url":"https://api.github.com/users/yodalee/followers","following_url":"https://api.github.com/users/yodalee/following{/other_user}","gists_url":"https://api.github.com/users/yodalee/gists{/gist_id}","starred_url":"https://api.github.com/users/yodalee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yodalee/subscriptions","organizations_url":"https://api.github.com/users/yodalee/orgs","repos_url":"https://api.github.com/users/yodalee/repos","events_url":"https://api.github.com/users/yodalee/events{/privacy}","received_events_url":"https://api.github.com/users/yodalee/received_events","type":"User","site_admin":false},"repo":{"id":57477797,"name":"amacc","full_name":"yodalee/amacc","owner":{"login":"yodalee","id":1913143,"avatar_url":"https://avatars.githubusercontent.com/u/1913143?v=3","gravatar_id":"","url":"https://api.github.com/users/yodalee","html_url":"https://github.com/yodalee","followers_url":"https://api.github.com/users/yodalee/followers","following_url":"https://api.github.com/users/yodalee/following{/other_user}","gists_url":"https://api.github.com/users/yodalee/gists{/gist_id}","starred_url":"https://api.github.com/users/yodalee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yodalee/subscriptions","organizations_url":"https://api.github.com/users/yodalee/orgs","repos_url":"https://api.github.com/users/yodalee/repos","events_url":"https://api.github.com/users/yodalee/events{/privacy}","received_events_url":"https://api.github.com/users/yodalee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yodalee/amacc","description":"Small C Compiler generating ELF executable for ARM architecture","fork":true,"url":"https://api.github.com/repos/yodalee/amacc","forks_url":"https://api.github.com/repos/yodalee/amacc/forks","keys_url":"https://api.github.com/repos/yodalee/amacc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yodalee/amacc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yodalee/amacc/teams","hooks_url":"https://api.github.com/repos/yodalee/amacc/hooks","issue_events_url":"https://api.github.com/repos/yodalee/amacc/issues/events{/number}","events_url":"https://api.github.com/repos/yodalee/amacc/events","assignees_url":"https://api.github.com/repos/yodalee/amacc/assignees{/user}","branches_url":"https://api.github.com/repos/yodalee/amacc/branches{/branch}","tags_url":"https://api.github.com/repos/yodalee/amacc/tags","blobs_url":"https://api.github.com/repos/yodalee/amacc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yodalee/amacc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yodalee/amacc/git/refs{/sha}","trees_url":"https://api.github.com/repos/yodalee/amacc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yodalee/amacc/statuses/{sha}","languages_url":"https://api.github.com/repos/yodalee/amacc/languages","stargazers_url":"https://api.github.com/repos/yodalee/amacc/stargazers","contributors_url":"https://api.github.com/repos/yodalee/amacc/contributors","subscribers_url":"https://api.github.com/repos/yodalee/amacc/subscribers","subscription_url":"https://api.github.com/repos/yodalee/amacc/subscription","commits_url":"https://api.github.com/repos/yodalee/amacc/commits{/sha}","git_commits_url":"https://api.github.com/repos/yodalee/amacc/git/commits{/sha}","comments_url":"https://api.github.com/repos/yodalee/amacc/comments{/number}","issue_comment_url":"https://api.github.com/repos/yodalee/amacc/issues/comments{/number}","contents_url":"https://api.github.com/repos/yodalee/amacc/contents/{+path}","compare_url":"https://api.github.com/repos/yodalee/amacc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yodalee/amacc/merges","archive_url":"https://api.github.com/repos/yodalee/amacc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yodalee/amacc/downloads","issues_url":"https://api.github.com/repos/yodalee/amacc/issues{/number}","pulls_url":"https://api.github.com/repos/yodalee/amacc/pulls{/number}","milestones_url":"https://api.github.com/repos/yodalee/amacc/milestones{/number}","notifications_url":"https://api.github.com/repos/yodalee/amacc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yodalee/amacc/labels{/name}","releases_url":"https://api.github.com/repos/yodalee/amacc/releases{/id}","deployments_url":"https://api.github.com/repos/yodalee/amacc/deployments","created_at":"2016-05-01T03:56:33Z","updated_at":"2016-05-01T03:56:34Z","pushed_at":"2016-05-01T13:04:51Z","git_url":"git://github.com/yodalee/amacc.git","ssh_url":"git@github.com:yodalee/amacc.git","clone_url":"https://github.com/yodalee/amacc.git","svn_url":"https://github.com/yodalee/amacc","homepage":"","size":84,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jserv:master","ref":"master","sha":"48045195d9efa581cf9289fc79892efcb8d4ef2c","user":{"login":"jserv","id":478921,"avatar_url":"https://avatars.githubusercontent.com/u/478921?v=3","gravatar_id":"","url":"https://api.github.com/users/jserv","html_url":"https://github.com/jserv","followers_url":"https://api.github.com/users/jserv/followers","following_url":"https://api.github.com/users/jserv/following{/other_user}","gists_url":"https://api.github.com/users/jserv/gists{/gist_id}","starred_url":"https://api.github.com/users/jserv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jserv/subscriptions","organizations_url":"https://api.github.com/users/jserv/orgs","repos_url":"https://api.github.com/users/jserv/repos","events_url":"https://api.github.com/users/jserv/events{/privacy}","received_events_url":"https://api.github.com/users/jserv/received_events","type":"User","site_admin":false},"repo":{"id":50844155,"name":"amacc","full_name":"jserv/amacc","owner":{"login":"jserv","id":478921,"avatar_url":"https://avatars.githubusercontent.com/u/478921?v=3","gravatar_id":"","url":"https://api.github.com/users/jserv","html_url":"https://github.com/jserv","followers_url":"https://api.github.com/users/jserv/followers","following_url":"https://api.github.com/users/jserv/following{/other_user}","gists_url":"https://api.github.com/users/jserv/gists{/gist_id}","starred_url":"https://api.github.com/users/jserv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jserv/subscriptions","organizations_url":"https://api.github.com/users/jserv/orgs","repos_url":"https://api.github.com/users/jserv/repos","events_url":"https://api.github.com/users/jserv/events{/privacy}","received_events_url":"https://api.github.com/users/jserv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jserv/amacc","description":"Small C Compiler generating ELF executable for ARM architecture","fork":false,"url":"https://api.github.com/repos/jserv/amacc","forks_url":"https://api.github.com/repos/jserv/amacc/forks","keys_url":"https://api.github.com/repos/jserv/amacc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jserv/amacc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jserv/amacc/teams","hooks_url":"https://api.github.com/repos/jserv/amacc/hooks","issue_events_url":"https://api.github.com/repos/jserv/amacc/issues/events{/number}","events_url":"https://api.github.com/repos/jserv/amacc/events","assignees_url":"https://api.github.com/repos/jserv/amacc/assignees{/user}","branches_url":"https://api.github.com/repos/jserv/amacc/branches{/branch}","tags_url":"https://api.github.com/repos/jserv/amacc/tags","blobs_url":"https://api.github.com/repos/jserv/amacc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jserv/amacc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jserv/amacc/git/refs{/sha}","trees_url":"https://api.github.com/repos/jserv/amacc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jserv/amacc/statuses/{sha}","languages_url":"https://api.github.com/repos/jserv/amacc/languages","stargazers_url":"https://api.github.com/repos/jserv/amacc/stargazers","contributors_url":"https://api.github.com/repos/jserv/amacc/contributors","subscribers_url":"https://api.github.com/repos/jserv/amacc/subscribers","subscription_url":"https://api.github.com/repos/jserv/amacc/subscription","commits_url":"https://api.github.com/repos/jserv/amacc/commits{/sha}","git_commits_url":"https://api.github.com/repos/jserv/amacc/git/commits{/sha}","comments_url":"https://api.github.com/repos/jserv/amacc/comments{/number}","issue_comment_url":"https://api.github.com/repos/jserv/amacc/issues/comments{/number}","contents_url":"https://api.github.com/repos/jserv/amacc/contents/{+path}","compare_url":"https://api.github.com/repos/jserv/amacc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jserv/amacc/merges","archive_url":"https://api.github.com/repos/jserv/amacc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jserv/amacc/downloads","issues_url":"https://api.github.com/repos/jserv/amacc/issues{/number}","pulls_url":"https://api.github.com/repos/jserv/amacc/pulls{/number}","milestones_url":"https://api.github.com/repos/jserv/amacc/milestones{/number}","notifications_url":"https://api.github.com/repos/jserv/amacc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jserv/amacc/labels{/name}","releases_url":"https://api.github.com/repos/jserv/amacc/releases{/id}","deployments_url":"https://api.github.com/repos/jserv/amacc/deployments","created_at":"2016-02-01T14:20:05Z","updated_at":"2016-04-30T15:19:50Z","pushed_at":"2016-05-01T13:04:51Z","git_url":"git://github.com/jserv/amacc.git","ssh_url":"git@github.com:jserv/amacc.git","clone_url":"https://github.com/jserv/amacc.git","svn_url":"https://github.com/jserv/amacc","homepage":"","size":72,"stargazers_count":253,"watchers_count":253,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":3,"forks":56,"open_issues":3,"watchers":253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jserv/amacc/pulls/18"},"html":{"href":"https://github.com/jserv/amacc/pull/18"},"issue":{"href":"https://api.github.com/repos/jserv/amacc/issues/18"},"comments":{"href":"https://api.github.com/repos/jserv/amacc/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/jserv/amacc/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/jserv/amacc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jserv/amacc/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/jserv/amacc/statuses/891abb861076b87a441940eeaf7bce9dd7917152"}}}}