ONEforALL-S003 / ONE

On-device Neural Engine / q-implant
Other
1 stars 2 forks source link

Q test #4

Open wnwoghd22 opened 1 year ago

wnwoghd22 commented 1 year ago

제대로 동작하지 않지만... 일단 테스트 실행을 위한 스크립트 작성중입니다. 참고로 py 스크립트는 비어있습니다.

Judgement9882 commented 1 year ago

만약 one 디렉토리가 root에 있어서 nncc test를 진행할 때

Process not started
 /one/compiler/q-implant/tests/temp.sh
[permission denied]

이런 에러가 뜨면

$ chmod +777 temp.sh

해서 temp.sh의 실행할 수 있는 권한을 전체 사용자로 바꿔주세요.

Judgement9882 commented 1 year ago

실행된 후 기록은 LastTest.log 에 남습니다.

경로 : build/Testing/Temporary/LastTest.log

89/118 Testing: q_implant_export_test
89/118 Test: q_implant_export_test
Command: "/one/compiler/q-implant/tests/temp.sh" "/one/build/compiler/q-implant/tests" "/one/build/ov>
Directory: /one/build/compiler/q-implant/tests
"q_implant_export_test" start time: Sep 19 09:27 KST
Output:
----------------------------------------------------------
test
PASSED
<end of output>
Test time =   0.02 sec
----------------------------------------------------------
Test Passed.
"q_implant_export_test" end time: Sep 19 09:27 KST
"q_implant_export_test" time elapsed: 00:00:00
----------------------------------------------------------

다른 로그의 예시를 보면

90/118 Testing: buddy_manager_test
90/118 Test: buddy_manager_test
Command: "/one/build/compiler/luci-interpreter/src/buddy_manager_test"
Directory: /one/build/compiler/luci-interpreter/src
"buddy_manager_test" start time: Sep 19 09:27 KST
Output:
----------------------------------------------------------
Running main() from /one/externals/GTEST/googletest/src/gtest_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from BuddyMemoryManager
[ RUN      ] BuddyMemoryManager.basic
[       OK ] BuddyMemoryManager.basic (0 ms)
[----------] 1 test from BuddyMemoryManager (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.
<end of output>
Test time =   0.00 sec
----------------------------------------------------------
Test Passed.
"buddy_manager_test" end time: Sep 19 09:27 KST
"buddy_manager_test" time elapsed: 00:00:00
----------------------------------------------------------

이런식으로 테스트를 진행합니다.

Judgement9882 commented 1 year ago

로그를 다시 분석해보니 위 처럼 RUN OK 로 나오는 테스트도 있고 아니면 그냥 특정 파일을 실행하는 테스트도 있었습니다.

108/118 Testing: luci_value_test
108/118 Test: luci_value_test
Command: "/one/compiler/luci-value-test/evalverify.sh" "/one/build/compiler/luci-value-test" "/one/bu>
Directory: /one/build/compiler/luci-value-test
"luci_value_test" start time: Sep 19 09:28 KST
Output:
----------------------------------------------------------
PASSED
<end of output>
Test time = 330.37 sec
----------------------------------------------------------
Test Passed.
"luci_value_test" end time: Sep 19 09:34 KST
"luci_value_test" time elapsed: 00:05:30
----------------------------------------------------------

109/118 Testing: luci_value_tol_test
109/118 Test: luci_value_tol_test
Command: "/one/compiler/luci-value-test/evalverifytol.sh" "/one/build/compiler/luci-value-test" "/one>
Directory: /one/build/compiler/luci-value-test
"luci_value_tol_test" start time: Sep 19 09:34 KST
Output:
----------------------------------------------------------
PASSED
<end of output>
Test time =   7.68 sec
----------------------------------------------------------
Test Passed.
"luci_value_tol_test" end time: Sep 19 09:34 KST
"luci_value_tol_test" time elapsed: 00:00:07
----------------------------------------------------------

차이점

RUN, OK 하는 테스트는 Google Test로 보입니다. 특정 명령에 대한 예상값을 미리 입력하고 테스트를 진행하고 나온 출력값이 같으면 OK하는 형태입니다.

RUN OK 안하는거는 luci-value-test에서 보신바와 같이 python 코드로 실행되는 것 같습니다. 해당 코드에서 반환하는 값에 따라 PASS일지 FAIL일지 결정하는 방식으로 설계할 수 있습니다.

그럼 우리는?

q-implant는 input circle, qparam.json을 받아 output.circle을 생성합니다.

  1. input.circle이 제대로 된 circle인지 검증

  2. qparam.json에 속한 .npy가 다 있는지

  3. .npy 가 유효한 형식인지 (이게 가능한건가..?) (이건 extract에서 해도 될 것 같습니다.)

  4. qimplant 실행해서 output.circle이 만들어지는지

  5. output.circle은 input.circle과 비교했을때 달라진 tensor를 들고있는지 (우선순위 1 : 4, 2 : 5)

등등의 테스트가 가능할 것 같은데, 이러한 부분은 GTest 보다는 .py로 각각 구현하고 .sh 스크립트로 각각 실행한 결과가 OK인지 확인하면 될 것 같습니다.