From: Utkarsh Tiwari Date: Tue, 7 May 2024 10:15:45 +0000 (+0530) Subject: [TCT][Tool][Non-ACR] Korean and Deprecated API support added in Smart TC tool X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5db69e89b4fadd1a9f0bf17bf4d70ad10df3d4e4;p=test%2Ftct%2Fnative%2Fapi.git [TCT][Tool][Non-ACR] Korean and Deprecated API support added in Smart TC tool Change-Id: Ide76f7ef9ea8a4373cbd29f5058cadf3edeb9097 Signed-off-by: Utkarsh Tiwari --- diff --git a/tool/TC_Assistant_Tool/Ko_Lang_Support/data_TCT_KOR.json b/tool/TC_Assistant_Tool/Ko_Lang_Support/data_TCT_KOR.json new file mode 100644 index 000000000..22b4f258f --- /dev/null +++ b/tool/TC_Assistant_Tool/Ko_Lang_Support/data_TCT_KOR.json @@ -0,0 +1,186 @@ +{ + "intents": [ + { + "tag": "request", + "patterns": ["Hi, I have an ACR request", "I want you to add new utc"], + "responses": [ + "새로운 모듈에 대한 요청입니까? 아니면 추가 API 커버리지에 대한 요청입니까?" + ] + }, + { + "tag": "existingmodule", + "patterns": [ + "Its existing module, need to add new TCs", + "webrtc module request to add two new TCs" + ], + "responses": ["\nModule 이름: \n\n의 형태로 module 이름을 제공하십시오 [ 탐색하려면 'Back'를 입력하십시오]"] + }, + { + "tag": "modulename", + "patterns": ["Module name:", "module name is dlog"], + "responses": [ + "API 정보를 \nAPI 이름: API_NAME_1 API_NAME_2 \n\n 형식으로 제공하십시오[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "apiinfo", + "patterns": [ + "API names are as follows", + "API pre-post conditions are as follows" + ], + "responses": ["rootstrap에서 찾았습니다 ,감사합니다", "rootstrap에는없습니다"] + }, + { + "tag": "prepostinfo", + "patterns": [ + "Pre-condition API names are as follows", + "API pre-post conditions are as follows" + ], + "responses": ["pre/post API에 대한 세부 정보를 제공해 주셔서 감사합니다.\nSorry, 그러나 내부 오류가 있습니다. 도구를 다시 실행십시오"] + }, + { + "tag": "tcwritelocation", + "patterns": [ + "FILE name: utc-media-webrtc.c", + "FILE name:" + ], + "responses": ["입력을 제공해 주셔서 감사합니다."] + }, + { + "tag": "newmodule", + "patterns": [ + "Its request for new module addition", + "New module utc needs to be added" + ], + "responses": [ + "\nModule 이름: \n\n의 형태로 module 이름을 제공하십시오 [ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "negativetc", + "patterns": [ + "Do you want to add negative TCs? \nType Yes or No", + "Add a negative TC \nType Yes or No" + ], + "responses": [ + "입력을 잘못된 것 같습니다. 다시 시도하십시오.감사합니다" + ] + }, + { + "tag": "tizenversion", + "patterns": ["Tizen 6.0", "Tizen 6.5", "Tizen 7.0", "all"], + "responses": ["\nModule 이름: \n\n의 형태로 module 이름을 제공하십시오 [ 탐색하려면 'Back'를 입력하십시오]"] + }, + { + "tag": "modulenotfound", + "patterns": ["No"], + "responses": [ + "module을 찾을 수 없습니다 \n 모듈 이름을 \n모듈 이름 형식으로 다시 입력하십시오", + "module명 다시 확인하십시오. 입력한 module명이 없습니다.\n 모듈 이름을 \n모듈 이름: \n\n의 형태로 다시 입력해 주세요 [탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "buildwrittentc", + "patterns": ["No"], + "responses": [ + "감사합니다!!", + "입력을 제공해 주셔서 감사합니다." + ] + }, + { + "tag": "installwrittentc", + "patterns": ["No"], + "responses": [ + "감사합니다!!", + "입력을 제공해 주셔서 감사합니다." + ] + }, + { + "tag": "buildparameters", + "patterns": ["ARCH: armv7l, Profile: mobile", "ARCH: x86, Profile: wearable"], + "responses": [ + "\nARCH: ARCHITECTURE_NAME, PROFILE: PROFILE_NAMEE의 형식으로 TC를 구축하고자 하는 아키텍처 및 프로파일을 제공하십시오." + ] + }, + { + "tag": "launchtctmgr", + "patterns": ["Yes, I want to execute the TCs"], + "responses": [ + "tpk 설치중…" + ] + }, + { + "tag": "greetings", + "patterns": ["Hi", "Hello", "Hey"], + "responses": [ + "안녕하세요, 이것은 새로운 모듈에 대한 요청입니까 아니면 기존 모듈에 대한 요청입니까?" + ] + }, + { + "tag": "goback", + "patterns": ["Back"], + "responses": [ + "Going Back" + ] + }, + { + "tag": "none", + "patterns": [ + "" + ], + "responses": [ + "오류!! \nInvalid Input. 다시 작성을 시도하십시오" + ] + + }, + { + "tag": "featureinfo", + "patterns": ["feature"], + "responses": [ + "위 API에 대해 Pre 및 Post 조건 API를 추가하고 싶으신가요?\n (Yes or No)\n\n [탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "supportsys", + "patterns": ["Support", "I want support for issue"], + "responses": [ + "아래 옵션 중 선택하십시오. \n\na. Build 이슈\nb. Install 이슈\nc. 환경 설정\nd. Rootstrap install\ne. 다른 문제 \n\n[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "envsetupsupport", + "patterns": ["I need help for environment setup", "I want support for setup issue"], + "responses": [ + "환경설정\n\na. https://developer.tizen.org/development/tizen-studio/download\n에서 TizenStudio (Tizen Studio 3.7) 다운로드 및 install\nb. ITVOC\n을 사용하여 JAVA 8/9 install\nc. TizenStudio 1대 설치, Launch Package Manager\n-In Package Manager 아래 변경 사항 :\n-Package Repository: http://107.110.2.162/packages\n- Distribution: tizen_studio_5.5\n [Linux machine에서 package manager 사용하여 rootstrap을 업데이트/install함에 따라]\nd. 5.5 emulator 출시되고 잘 작동하고 있는지 확인하십시오.\n\n[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "rootstrapsupport", + "patterns": ["I need help for installing rootstrap", "I want support for rootstrap installation issue"], + "responses": [ + "Rootstrap install 가이드/단계:\n\na. sdk-build repo 코드 다운로드 : \ngit 클론 ssh://[user-id]@review.tizen.org:29418/sdk/tools/sdk-build -b tizen~/sdk-build\ngit checkout tizen\nexport PATH=~/sdk-build:$PATH'\n\nb. 'add-on' install (Tizeniot의 경우에만 이 점 (b)를 모바일, 웨어러블에 참조하지 마세요) \nadd-on 다운로드 경로 : http://10.113.245.23/download/tct/template/tizeniot/\n명령어 : ~/sdk-build/pkg-cli install-file -P -l~/tizen-studio -force\n\nc. tizeniot rootstrap install : \npath : https://bart.sec.samsung.net/artifactory/download-tizen-generic/snapshots/TIZEN/Tizen/Tizen-Unified/\n명령어 : ~/sdk-build/pkg-cli install-file -P -l~/tizen-studio -force\n\n[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "buildsupport", + "patterns": ["I need help regarding build issue", "I want support for build related issue"], + "responses": [ + "아래 텍스트 박스에 Build 오류 라인을 입력하여 LOG: BUILD_FAIL_LOGS\n\n의 분석하십시오.\n\n[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "buildlogdebug", + "patterns": ["Build Logs:"], + "responses": [ + "Build 실패는 암묵적 선언, 키스토어 암호 오류 등 여러 가지 이유 때문일 수 있습니다.\n\n[ 탐색하려면 'Back'를 입력하십시오]" + ] + }, + { + "tag": "installsupport", + "patterns": ["I need help regarding install isuue"], + "responses": [ + "Install 실패는 python버전, workspace에 TPK가 존재하지 않는 등 여러 가지 이유 때문일 수 있습니다. 문제를 해결하기 위해 아래 단계를 따르십시오. -\n\n- Python 버전이 3.0보다 큰지 확인하시고 그렇지 않다면 버전을 업그레이드하십시오. \n\n- Workspace 폴더 내부에 TPK가 생성되어 있는지확인하십시오. 생성되지 않으면 빌드를 다시 시도하십시오.\n\n [탐색하려면 'Back'를 입력하십시오]" + ] + } + ] +} diff --git a/tool/TC_Assistant_Tool/Ko_Lang_Support/eng_ko_replies.csv b/tool/TC_Assistant_Tool/Ko_Lang_Support/eng_ko_replies.csv new file mode 100644 index 000000000..f67652a5b --- /dev/null +++ b/tool/TC_Assistant_Tool/Ko_Lang_Support/eng_ko_replies.csv @@ -0,0 +1,65 @@ +key,Val_English,Val_Korean +translate_1,"Invalid response, please try again!!",잘못된 응답입니다. 다시 시도하십시오!! +translate_2,"Please enter supported features for the above-mentioned APIs, in the form of \nFeature name:\n\n[ To navigate, please type 'Back' ]","위의 API에 대해 지원하는 feature\nfeature 이름 형식으로 입력하십시오 +Feature 이름: \n\n[ 탐색하려면 'Back'를 입력하십시오]" +translate_3,"Feature details skipped.\nDo you want to add Pre and Post condition APIs for the above APIs?\n(Yes or No)\n\n[ To navigate, please type 'Back' ]","Feature 세부사항 생략되었습니다.\n위의 API에 대해 Pre 및 Post 조건 API를 추가하시겠습니까?\n(네, 아니오)\n\n[탐색하려면 'Back'를 입력하십시오]" +translate_4,Please enter Pre and Post condition APIs for API: ,API에 대한 Pre 및 Post 조건 API를 입력하십시오: +translate_5, in the format of \nPre: API_NAME_1 API_NAME_2 Post: API_NAME_1 API_NAME_2 separated by space\n\n If you don't want to write pre and post APIs for,형식에서: \nPre: API_NAME_1 API_NAME_2 Post: API_NAME_1 API_NAME_2 공백으로 구분됨\n\n Pre 및 Post API를 작성하지 않으려는 경우 +translate_6," please write 'Pre:'\n\n[ To navigate, please type 'Back' ]",Pre:'라고 적어주세요\n\n[탐색하려면 'Back'를 입력하십시오] +translate_7,"Negative TCs not possible for this API, Only positive TCs will be created. \n\n","이 API에서는 Negative TC가 불가능합니다, 오직 긍정적인 TC생성될 것입니다." +translate_8,Thank You for providing input. \n,입력을 제공해 주셔서 감사합니다\n. +translate_9,Thank You for providing input. Only positive TCs will be created \n,입력을 제공해 주셔서 감사합니다. 오직 긍정적인 TC생성될 것입니다\n +translate_11,All .C TC Code files in the mentioned directory are listed as below \n,언급된 디렉토리의 C TC 코드 file은 다음과 같습니다. \n +translate_12,"Please provide the file name in which you want to write the TC in the format of \nFILE name: NAME_OF_THE_FILE.c\n\n[ To navigate, please type 'Back' ]",TC를 작성하고 싶으신 file이름을\nFILE 이름 형식으로 제공하십시오: NAME_OF_THE_FILE.c\n\n[탐색하려면 'Back'를 입력하십시오] +translate_13,Do you want to continue for next module ? (Yes/No),다음 module 계속하시겠습니까? (네/아니오) +translate_14,"Module name already exists. Please write module name apart from existing one.\nPlease provide module name in the form of \nModule name:\n\n[ To navigate, please type 'Back' ]",이미 존재하는 module 이름입니다. 기존 module 이름과 다른 module 이름을 작성해주십시오.\n다음과 같은 양식으로 module 이름을 제공해주세요:\nModule name: \n\n[ 탐색을 원하시면 'Back'을 입력하세요 ] +translate_15,"No Module name details entered!! \n\n Please provide Module name in the format of \n Module name:\n\n [ To navigate, please type 'Back' ]",Module 이름에 대한 세부 정보가 입력되지 않았습니다!! \n\nModule 이름 형식로 Module 이름을 제공하십시오: \n\n[탐색하려면 'Back'를 입력하십시오] +translate_16,"Please enter Header file details in the format of \nHeader File: HEADER_FILE_1 HEADER_FILE_2\n\n[ To navigate, please type 'Back' ]",Header File 세부 정보를 의 형식으로 입력하십시오\nHeader file: HEADER_FILE_1 HEADER_FILE_2\n\n[ 탐색하려면 'Back'를 입력하십시오] +translate_17,Module name not found[Please check mapping file: Module_Header_Mapping.csv]\n\nDid you mean ?\n,Module이름을 찾을 수 없습니다[Mapping file을 확인해주시기 바랍니다: module_header_Mapping.csv]\n\n 무슨 뜻입니까? +translate_18,"Type Yes to continue otherwise type No\n\n[ To navigate, please type 'Back' ]", 계속 진행하려면 Yes를 그렇지 않으면 No를 입력하세요\n\n[탐색하려면 'Back'를 입력하십시오] +translate_19,"Module name not found[Please check mapping file: Module_Header_Mapping.csv], \n\nPlease type the module name again in the form of \nModule name:\n\n[ To navigate, please type 'Back' ]","Module이름을 찾을 수 없습니다 [Mapping file 확인하십시오: Module_Header_Mapping.csv], \n\n형식으로 module 이름을 다시 입력하십시오. +Module이름:\n\n[탐색하려면 'Back'를 입력하십시오]" +translate_20,"Header file not found in rootstrap! So, Module not created.Please enter the correct header file details in the form of form of \nHeader File:\n\n[ To navigate, please type 'Back' ]",Rootstrap에서 header file 찾을 수 없습니다! 따라서 module 생성되지 앟습니다.\n 올바른 header file 세부 정보를 \nheader file:\n\n[ 탐색하려면 'Back'를 입력하십시오]의 형태로 입력하십시오. +translate_21,"Please provide API information in the format of \nAPI names: API_NAME_1 API_NAME_2 \n\n[ To navigate, please type 'Back' ]",API 정보를 \nAPI 이름 형식으로 제공해주시기 바랍니다.API 이름 : API_NAME_1 API_NAME_2\n\n[탐색하려면 'Back'를 입력하십시오] +translate_22,"No Header File details entered!! \n\n Please provide Header File details in the format of \n Header File :\n\n [ To navigate, please type 'Back' ] ",Header file 대한 세부 정보를 입력하지 않았습니다!\n\nHeader file 형식을 제공해주시기 바랍니다.Header File:\n\n [탐색하려면 'Back'를 입력하십시오] +translate_23,ThankYou for providing input.\nTC already exists for API:,제공해주셔서 입력 대해 감사합니다.\nAPI에 대해 이미 TC 존재합니다 +translate_24,"Please try writing again.\n\n[ To navigate, please type 'Back' ]",다시 작성해보시기 바랍니다\n\n[탐색하려면 'Back'를 입력하십시오] +translate_25,"Thankyou, APIs found in rootstrap.\nDo you want to add Feature for above APIs?\n(Yes or No)\n\n[ To navigate, please type 'Back' ]","감사합니다. Rootstrap에서 발견된 API입니다.\n위의 API에 feature을 추가하시겠습니까??\n(예, 아니오)\n\n[탐색하려면'Back'를입력하십시오]" +translate_26,APIs not present in rootstraps. Please try writing again.\n\nAll the APIs present in the header file are mentioned below for your reference:,Rootstrap에는 해당 API가 없습니다. 다시 한번 작성해보세요.\n\nheader file 있는 모든 API는 아래에 나열되어 있으니 참고하시기 바랍니다. +translate_27,Header File Name: ,Header File 이름 : +translate_28,\n\n\nPlease provide API information in the format of \nAPI names:,\n\n\n\nAPI 이름으로 형식에 맞는 API 정보를 제공해 주세요 +translate_29,"Header File not found in rootstrap, Please check Module_Header_Mapping.csv", Header File이 rootstrap에 없는 경우 Module_Header_Mapping.csv 확인 부탁드립니다 +translate_30,"No API details entered !!\n\nPlease provide API information in the format of \nAPI names:\n\n[ To navigate, please type 'Back' ]","API 세부 정보가 입력되지 않았습니다!!\n\n API 정보를 \n 형식으로 제공해주세요 +API 이름: \n\n[ 탐색하려면 'Back'를 입력하십시오] +" +translate_31,"Do you want to add Pre and Post condition APIs for the above APIs?\n(Yes or No)\n\n[ To navigate, please type 'Back' ]","위 API에 대한 Pre 및 Post 조건 API를 추가하시겠습니까?\n(네, 아니오)\n\n[탐색하려면 'Back'를 입력하십시오] +" +translate_32,"No Feature details entered!!\n\nPlease enter supported features for the above-mentioned APIs, in the form of \nFeature name:\n\n[ To navigate, please type 'Back' ]",Feature 세부 사항이 입력되지 않았습니다!!\n\n위에서 언급한 API에서 지원하는 feature을 다음 형식으로 입력하십시오.feature 이름:\n\n과 같은 형식으로 작성해 주세요\n\n[탐색하려면 'Back'를 입력하십시오] +translate_33,"Thankyou, for providing details for pre/post APIs for",\nAPI에 대한 pre/post API에 대한 세부 정보를 제공해 주셔서 감사합니다: +translate_34,\nPlease Enter pre/post APIs for API:,\nAPI용 pre/post API를 입력해주세요: +translate_35,\n\n If you don't want to write pre and post APIs for API:,\n\n API에 대한 사전/사후 API를 작성하고 싶지 않다면 +translate_36," please write 'Pre:'\n\n[ To navigate, please type 'Back' ]",Pre: 를 작성하십시오\n\n[탐색하려면 'Back'를 입력하십시오] +translate_37,"Thankyou, for providing details for pre/post APIs for ",APIs pre/post 대한 세부 정보를 제공해 주셔서 감사합니다 +translate_38,Pre and Post condition skipped.\n\n,pre 및 post 조건이 생략되었습니다.\n\n. +translate_39,Thank You for providing pre/post condition APIs. \n\n,pre/post 조건 API를 제공해 주셔서 감사합니다.\n\n +translate_40,"Do you want to add negative TCs also?\n(Yes or No)\n\n[ To navigate, please type 'Back' ]","Negative TC 추가하길 원하시나요?\n(네, 아니오)\n\n[탐색하려면 'Back'를 입력하십시오]" +translate_41,Pre/Post condition APIs provided by you does not exists.\n\n[ Please type 'Back' and provide all Pre/Post APIs data again. ],제공하는 Pre/Post 조건 API는 존재하지 않습니다.\n\n[ 'Back'를 입력하고 모든 Pre/Post API 데이터를 다시 제공하십시오.] +translate_42,TC is created successfully at path : ,경로에 TC가 성공적으로 생성되었습니다. +translate_43,Do you want to build ?\n(Yes or No),Build 싶습니까?\n(예 또는 아니오 +translate_44,"Thankyou, for providing file name.\nTC is created successfully at path : ",File 이름 제공해 주셔서 감사합니다.\nTC는 경로에서 성공적으로 생성됩니다. +translate_45,Do you want to build ?\n(Yes or No),Build 싶습니까?\n(예 또는 아니오 +translate_46,"Thankyou, for providing file name.A new file will be created at path : ",File 이름 제공해 주셔서 감사합니다.경로에서 새로운 file이 생성됩니다: +translate_47,Do you want to build ?\n(Yes or No),Build 싶습니까?\n(예 또는 아니오 +translate_48,"File name details not entered!! \n\n Please provide file name in the format of \nFile name:\n\n [ To navigate, please type 'Back' ]","File이름 세부 정보가 입력되지 않았습니다!!\n\n file이름을 \n형식으로 제공하십시요 +File이름:\n\n[ 탐색하려면 'Back'를 입력하십시오]" +translate_49,Build Started !! Please wait...,Build 시작되었습니다!! 잠시만 기다려주세요... +translate_50,CREATION SUCCESSFUL,생성 성공 +translate_51,Build completed successfully\n\nDo you want to execute TCs?\n(Yes or No),"Build가 성공적으로 완료되었습니다\n\nTC를 실행하시겠습니까?\n(네, 아니오)" +translate_52,"Build Failed, Please check the TC file and try again.",Build 실패했습니다. TC file을 확인하고 다시 시도하십시오. +translate_53,Build parameters values are not correct\nPlease try again..,Build 매개 변수 값이 올바르지 않습니다.\n다시 시도하십시오 +translate_54,Installing the package...Make sure the target is connected\nLaunching TCT-MGR tool\n\nDo you want to continue for another module?,Package 설치 대상이 연결되어 있는지 확인\nLaunching TCT-MGR tool\n\n다른 module 위해 계속하시겠습니까? +translate_55,"\n\n [ To navigate, please type 'Back' ]",\n\n[탐색하려면 'Back'를 입력하십시오] +translate_56,You can't go back at this stage. Please write the appropriate inputs,이 단계에서는 뒤로 갈 수 없습니다. 적절한 입력을 작성하세요 +translate_57,Please select numbers for the corresponding stage you want to go to:\n,다음 단계로 이동할 해당 단계를 선택하십시오:\n +translate_58,"If you wish to EXIT, Please type Exit","만약 종료하고 싶으시다면, 'Exit'라고 입력해주세요" +translate_59,Invalid Input. Please try writing again,잘못된 입력입니다. 다시 작성해보세요 diff --git a/tool/TC_Assistant_Tool/Ko_Lang_Support/get_eng_or_ko.py b/tool/TC_Assistant_Tool/Ko_Lang_Support/get_eng_or_ko.py new file mode 100644 index 000000000..c928a77a4 --- /dev/null +++ b/tool/TC_Assistant_Tool/Ko_Lang_Support/get_eng_or_ko.py @@ -0,0 +1,12 @@ +# from read_csv_ko import * +from Ko_Lang_Support.read_csv_ko import * + +def get_en_or_ko_replies(key, radio_btn_val): + if radio_btn_val == 1: + lang_idx = 0 + elif radio_btn_val == 2: + lang_idx = 1 + val_en_ko = translation_dict_ko(key, lang_idx) + # print(val_en_ko) + return val_en_ko + diff --git a/tool/TC_Assistant_Tool/Ko_Lang_Support/read_csv_ko.py b/tool/TC_Assistant_Tool/Ko_Lang_Support/read_csv_ko.py new file mode 100644 index 000000000..99cf1ad46 --- /dev/null +++ b/tool/TC_Assistant_Tool/Ko_Lang_Support/read_csv_ko.py @@ -0,0 +1,18 @@ +import csv + + +def translation_dict_ko(key, lang_idx): + mydict = {} + + #Open the file in read mode + with open('Ko_Lang_Support/eng_ko_replies.csv', mode='r') as infile: + reader = csv.reader(infile, skipinitialspace=True) + for row in reader: + temp = row[1:] + temp1 = [] + for val in temp: + if not val: + continue + temp1.append(val) + mydict[row[0]] = temp1 + return mydict[key][lang_idx].replace('\\n', '\n') diff --git a/tool/TC_Assistant_Tool/Ko_Lang_Support/translate_lang.py b/tool/TC_Assistant_Tool/Ko_Lang_Support/translate_lang.py new file mode 100644 index 000000000..06f193457 --- /dev/null +++ b/tool/TC_Assistant_Tool/Ko_Lang_Support/translate_lang.py @@ -0,0 +1,13 @@ +# from translate import Translator +from deep_translator import GoogleTranslator + + +def translate_to_ko(to_translate): + translated = GoogleTranslator(source='auto', target='ko').translate(to_translate) + return translated + + +def translate_to_en(to_translate): + translated = GoogleTranslator(source='auto', target='en').translate(to_translate) + return translated + diff --git a/tool/TC_Assistant_Tool/Module_Header_Mapping.csv b/tool/TC_Assistant_Tool/Module_Header_Mapping.csv index 83d124175..97ad62d8a 100644 --- a/tool/TC_Assistant_Tool/Module_Header_Mapping.csv +++ b/tool/TC_Assistant_Tool/Module_Header_Mapping.csv @@ -120,3 +120,23 @@ widget_viewer_evas,widget_service/widget_errno.h,widget_service/widget_service.h wifi-direct,wifi-direct/wifi-direct.h,,,,,,,,,,,,,,,,,,,,, wifi-manager,network/wifi-manager.h,,,,,,,,,,,,,,,,,,,,, yaca,linux/stddef.h,yaca/yaca_crypto.h,yaca/yaca_error.h,yaca/yaca_key.h,yaca/yaca_sign.h,yaca/yaca_encrypt.h,yaca/yaca_digest.h,yaca/yaca_simple.h,yaca/yaca_types.h,yaca/yaca_rsa.h,yaca/yaca_seal.h,yaca/yaca_sign.h,yaca/yaca_simple.h,,,,,,,,, +lang2,location/locations.h +lang3,location/locations.h +testone,location/locations.h +testtwo,location/locations.h +testhree,location/locations.h +testfour,location/locations.h +qwerty1,location/locations.h +qwerty2,location/locations.h +qwerty6,location/locations.h +qwerty7,media/media_streamer.h +newmodule,location/locations.h +newmodule1,location/locations.h +newmodule3,location/locations.h +newmodule5,location/locations.h +alarm_new,appfw/app_alarm.h +media_new,media/media_streamer.h +media_new,media/media_streamer.h +media_new2,media/media_streamer.h +test_new,location/locations.h +tarunone,location/locations.h diff --git a/tool/TC_Assistant_Tool/Readme.md b/tool/TC_Assistant_Tool/Readme.md index 90a419d0b..7fcefc311 100644 --- a/tool/TC_Assistant_Tool/Readme.md +++ b/tool/TC_Assistant_Tool/Readme.md @@ -37,8 +37,8 @@ **For example:** - If user has entered webrtc module then tool will search for its header file media/webrtc.h in tizeniot-8.0-device.core.private.20230823_131527 rootstrap. - > Header file should be present at path /home/sri/tizen-studio/platforms/tizen-8.0/tizeniot/rootstraps/tizeniot-8.0-device.core.private.20230823_131527/usr/include, otherwise tool will run into error. + If user has entered webrtc module then tool will search for its header file media/webrtc.h in tizen-8.0-device.core.private.20230823_131527 rootstrap. + > Header file should be present at path /home/sri/tizen-studio/platforms/tizen-8.0/tizen/rootstraps/tizen-8.0-device.core.private.20230823_131527/usr/include, otherwise tool will run into error. 6. API's for which you need to create TCs, those api's declaration need to be present in the header files mentioned in Module_Header_Mapping.csv file diff --git a/tool/TC_Assistant_Tool/data_TCT.json b/tool/TC_Assistant_Tool/data_TCT.json index f589a3cc8..8b387dbe0 100644 --- a/tool/TC_Assistant_Tool/data_TCT.json +++ b/tool/TC_Assistant_Tool/data_TCT.json @@ -181,6 +181,27 @@ "responses": [ "Install fail may be due to many reasons like python version, TPK not present in workspace etc. Kindly follow the below steps to solve the issue :-\n\n- Check if python version is greater than 3.0, if not upgrade the version\n\n- Check if TPK is created inside workspace folder, if not try build again\n\n[ To navigate, please type 'Back' ]" ] + }, + { + "tag": "removeapi", + "patterns": ["Remove Deprecated APIs"], + "responses": [ + "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc.\n\n[ To navigate, please type 'Back' ]" + ] + }, + { + "tag": "inputremovalapi", + "patterns": ["DELETE: API_NAME_1, API_NAME_2"], + "responses": [ + "Above mentioned APIs will be removed. Please find TCs detail for these APIs as below \n\n[ To navigate, please type 'Back' ]" + ] + }, + { + "tag": "donotremove", + "patterns": ["EXCLUDE: 1, 2, 3, 4"], + "responses": [ + "APIs removed successfully. Type 'Exit' to close the tool." + ] } ] } diff --git a/tool/TC_Assistant_Tool/header_file_parse.py b/tool/TC_Assistant_Tool/header_file_parse.py index 02ee12198..09be30e55 100644 --- a/tool/TC_Assistant_Tool/header_file_parse.py +++ b/tool/TC_Assistant_Tool/header_file_parse.py @@ -76,7 +76,7 @@ def api_description_extract(MODULE_NAME, HEADER_FILE_NAME, API_SEARCH): ele = ele.replace('*', '') desc = desc + ele if flag == True and "@since" in ele or "@detail" in ele or "@details" in ele: - break + break desc = desc.replace('\r', '').replace('\n', '') diff --git a/tool/TC_Assistant_Tool/latest_rootstrap.py b/tool/TC_Assistant_Tool/latest_rootstrap.py index 8a704dfbe..86f0efeff 100644 --- a/tool/TC_Assistant_Tool/latest_rootstrap.py +++ b/tool/TC_Assistant_Tool/latest_rootstrap.py @@ -3,7 +3,7 @@ import os def latest_rootstrap(): rootstrap_folder_names = [] rootstrap_latest_folder_names = [] - ROOTSTRAP_DIR = r"/home/sri/tizen-studio/platforms/tizen-8.0/tizeniot/rootstraps" + ROOTSTRAP_DIR = r"/home/sri/tizen-studio/platforms/tizen-8.0/tizen/rootstraps" for entry_name in os.listdir(ROOTSTRAP_DIR): entry_path = os.path.join(ROOTSTRAP_DIR, entry_name) if os.path.isdir(entry_path): @@ -25,7 +25,7 @@ def latest_rootstrap(): min_len = 100 for ele in rootstrap_latest_folder_names: if len(ele) < min_len: - min_len = len(ele) + min_len = len(ele) res = ele find_latest = ROOTSTRAP_DIR + "//" + res return find_latest diff --git a/tool/TC_Assistant_Tool/list_module_files.py b/tool/TC_Assistant_Tool/list_module_files.py index 12bbb7982..a771c676c 100644 --- a/tool/TC_Assistant_Tool/list_module_files.py +++ b/tool/TC_Assistant_Tool/list_module_files.py @@ -15,6 +15,32 @@ def get_all_files_of_module(TC_WRITE_DIR, module_name): return '\n'.join(lst) +# Function uses ls command to list all the available files in the module and display it to the user in form of list. +def get_all_files_of_module_list(TC_WRITE_DIR, module_name): + lst = [] + TC_WRITE_DIR = TC_WRITE_DIR + '/' + module_name + command = f"ls {TC_WRITE_DIR}" + process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) + proc_stdout = process.communicate()[0].strip() + for line in proc_stdout.decode().split('\n'): + if line[-2:] == ".c" and line[:3] != "tct": + lst.append(line) + return lst + + +# Function uses ls command to list all the available files in the module and display it to the user in form of list. +def get_all_c_files_of_module_list(TC_WRITE_DIR, module_name): + lst = [] + TC_WRITE_DIR = TC_WRITE_DIR + '/' + module_name + command = f"ls {TC_WRITE_DIR}" + process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) + proc_stdout = process.communicate()[0].strip() + for line in proc_stdout.decode().split('\n'): + if line[-2:] == ".c" and 'utc' in line: + lst.append(line) + return lst + + # Function uses ls command to list all the available header files in the module def get_all_header_files_of_module(TC_WRITE_DIR, module_name): diff --git a/tool/TC_Assistant_Tool/modelweight.pth b/tool/TC_Assistant_Tool/modelweight.pth index d9e59ec60..a457810ba 100755 Binary files a/tool/TC_Assistant_Tool/modelweight.pth and b/tool/TC_Assistant_Tool/modelweight.pth differ diff --git a/tool/TC_Assistant_Tool/newdata.csv b/tool/TC_Assistant_Tool/newdata.csv deleted file mode 100755 index 1184916d7..000000000 --- a/tool/TC_Assistant_Tool/newdata.csv +++ /dev/null @@ -1,138 +0,0 @@ -,Text,label -0,add utc for webrtc apis,existingmodule -1,The module is already existing,existingmodule -2,REQUEST TO CREATE UTC OF NEW MODULE,newmodule -3,tizen version 6.5,tizenversion -4,Request is for Tizen version 6.0,tizenversion -5,REQUEST TO COVER NEW APIS,request -6,MODULE NAME: BLUETOOTH,modulename -7,MODULE NAME:,modulename -8,request to prepare utc,request -9,file name: utc_media_webrtc.c,tcwritelocation -10,THIS IS REQUEST TO COVER NEW MODULE APIS,newmodule -11,FILE NAME: UTC_MEDIA_WEBRTC.C,tcwritelocation -12,POST:,prepostinfo -13,HI,greetings -14,Add utc for webrtc APIs,existingmodule -15,file name:,tcwritelocation -16,pre: attach_panel_create,prepostinfo -17,"its existing module, need to add new tcs",existingmodule -18,"Its existing module, need to add new TCs",existingmodule -19,TIZEN VERSION 6.5,tizenversion -20,hello,greetings -21,Tizen 6.5,tizenversion -22,Tizen 7.0,tizenversion -23,Pre: attach_panel_show Post: attach_panel_destroy,prepostinfo -24,Request to create UTC of new module,newmodule -25,"ITS EXISTING MODULE, NEED TO ADD NEW TCS",existingmodule -26,Tizen version 6.5,tizenversion -27,the module is already existing,existingmodule -28,Request is for Tizen version 7.0,tizenversion -29,FILE NAME:,tcwritelocation -30,request is for tizen version 6.0,tizenversion -31,Tizen version 7.0,tizenversion -32,PRE:,prepostinfo -33,REQUEST IS FOR TIZEN VERSION 7.0,tizenversion -34,API names: attach_panel_create attach_panel_destroy,apiinfo -35,Tizen 6.0,tizenversion -36,module name:,modulename -37,request is for tizen version 6.5,tizenversion -38,tizen version 6.0,tizenversion -39,Post:,prepostinfo -40,tizen 6.0,tizenversion -41,module name: bluetooth,modulename -42,api names:,apiinfo -43,NEED TO ADD NEW APIS IN BLUETOOTH MODULE,existingmodule -44,API names:,apiinfo -45,Module name: bluetooth,modulename -46,Module name:,modulename -47,This is an ACR request,request -48,This is request to cover new module APIs,newmodule -49,file name: utc-messaging-email.c,tcwritelocation -50,REQUEST TO PREPARE UTC,request -51,pre: attach_panel_show post: attach_panel_destroy,prepostinfo -52,TIZEN 7.0,tizenversion -53,Tizen version 6.0,tizenversion -54,HELLO,greetings -55,tizen 7.0,tizenversion -56,TIZEN VERSION 7.0,tizenversion -57,THIS IS AN ACR REQUEST,request -58,FILE name: utc-messaging-email.c,tcwritelocation -59,post: attach_panel_destroy,prepostinfo -60,Pre: attach_panel_create,prepostinfo -61,PRE: ATTACH_PANEL_SHOW POST: ATTACH_PANEL_DESTROY,prepostinfo -62,REQUEST IS FOR TIZEN VERSION 6.5,tizenversion -63,API NAMES:,apiinfo -64,REQUEST IS FOR TIZEN VERSION 6.0,tizenversion -65,Request is for Tizen version 6.5,tizenversion -66,request to cover new apis,request -67,TIZEN 6.0,tizenversion -68,FILE name:,tcwritelocation -69,TIZEN 6.5,tizenversion -70,API NAMES: ATTACH_PANEL_CREATE ATTACH_PANEL_DESTROY,apiinfo -71,POST: ATTACH_PANEL_DESTROY,prepostinfo -72,tizen version 7.0,tizenversion -73,Request to cover new APIS,request -74,hi,greetings -75,hello,greetings -76,THE MODULE IS ALREADY EXISTING,existingmodule -77,request is for tizen version 7.0,tizenversion -78,Need to add new APIs in bluetooth module,existingmodule -79,post:,prepostinfo -80,FILE name: utc_media_webrtc.c,tcwritelocation -81,Request to prepare UTC,request -82,FILE NAME: UTC-MESSAGING-EMAIL.C,tcwritelocation -83,request to create utc of new module,newmodule -84,ARCH: PROFILE: ,executetc -85,need to add new apis in bluetooth module,existingmodule -86,this is request to cover new module apis,newmodule -87,Pre:,prepostinfo -88,hi,greetings -89,Post: attach_panel_destroy,prepostinfo -90,PRE: ATTACH_PANEL_CREATE,prepostinfo -91,ARCH: armv7l PROFILE: wearable,executetc -92,this is an acr request,request -93,pre:,prepostinfo -94,ARCH: armv7l PROFILE: tizeniot,executetc -95,TIZEN VERSION 6.0,tizenversion -96,ARCH: armv7l PROFILE: mobile,executetc -97,ADD UTC FOR WEBRTC APIS,existingmodule -98,api names: attach_panel_create attach_panel_destroy,apiinfo -99,ARCH: armv7l PROFILE: tv,executetc -100,tizen 6.5,tizenversion -101,header info:,headerinfo -102,Do you want to add negative TCs?,negativetc -103,Add a negative TC,negativetc -104,negative TC,negativetc -105,Header File:dns-sd.h,headerinfo -106,Back,goback -107,I want to go back,goback -108,Feature name:,featureinfo -109,feature:,featureinfo -110,New module:,newmodule -111,newmodule:,newmodule -112,Header File:,headerinfo -113,headerfile:,headerinfo -114,existing,existingmodule -115,I want to add negative tc,negativetc -116,NEW MODULE:webrtc,newmodule -117,pre:yaca_key_generate,prepostinfo -118,pre:yaca,prepostinfo -119,Pre:yaca,prepostinfo -120,PRE:yaca,prepostinfo -121,Module name:yaca,modulename -122,Support,supportsys -123,I want support for issue,supportsys -124,Environment Setup,envsetupsupport -125,Need help for environment setup,envsetupsupport -126,Installing rootstrap,rootstrapsupport -127,Need help for installing rootstrap,rootstrapsupport -128,Build Issue,buildsupport -129,I want support for build related issue,buildsupport -130,Logs:,buildlogdebug -131,log:,buildlogdebug -132,Install issue,installsupport -133,I want help regarding install issue,installsupport -134,Need support,supportsys -135,Support Assistant,supportsys -136,i need to add a new module,newmodule diff --git a/tool/TC_Assistant_Tool/remove_deprecated_api.py b/tool/TC_Assistant_Tool/remove_deprecated_api.py new file mode 100644 index 000000000..0c205fa00 --- /dev/null +++ b/tool/TC_Assistant_Tool/remove_deprecated_api.py @@ -0,0 +1,94 @@ +from list_module_files import * + +def delete_tc_from_all_c_files(REMOVE_TC_LIST, MODULE_NAME, CURR_C_FILE, TC_DIR_PATH): + TC_DIR_PATH_FINAL = f"{TC_DIR_PATH}/{MODULE_NAME}/{CURR_C_FILE}" + global start_line_no + global end_line_no + for tc_name in REMOVE_TC_LIST: + flag = 0 + with open(TC_DIR_PATH_FINAL, 'r') as file: + for i, line in enumerate(file, start=1): + if tc_name in line and "@testcase" in line: + start_line_no = i - 1 + flag = 1 + if flag == 1 and "/**" in line: + end_line_no = i - 1 + flag = 0 + break + with open(TC_DIR_PATH_FINAL, 'r') as file: + all_lines = file.readlines() + with open(TC_DIR_PATH_FINAL, 'w') as file: + for i, line in enumerate(all_lines, start=1): + if start_line_no <= i <= end_line_no: + continue + file.write(line) + + +def check_if_deprecated_tc_exists_in_header_files(TC_DIR_PATH, MODULE_NAME, REMOVE_API_NAMES, ALL_HEADER_FILES_IN_MODULE, REMOVE_TC_LIST, NOT_FOUND_API_LIST): + + for header_file in ALL_HEADER_FILES_IN_MODULE: + for api_name_deprecated in REMOVE_API_NAMES: + command = f"grep {api_name_deprecated} {TC_DIR_PATH}/{MODULE_NAME}/{header_file}&" + process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) + proc_stdout = process.communicate()[0].strip() + for line in proc_stdout.decode().split('\n'): + if api_name_deprecated in line and 'extern' in line: + split_list = line.split() + REMOVE_TC_LIST.append(split_list[2][:split_list[2].index('(')]) + REMOVE_TC_LIST = list(set(REMOVE_TC_LIST)) + + flag = False + for ele in REMOVE_API_NAMES: + for tc_name in REMOVE_TC_LIST: + if ele in tc_name: + flag = True + if flag == False: + NOT_FOUND_API_LIST.append(ele) + flag = False + + +def deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH): + global REMOVE_TC_LIST + global NOT_FOUND_API_LIST + REMOVE_TC_LIST = [] + NOT_FOUND_API_LIST = [] + is_semicolon_present = remove_api_names.find(',') + if(is_semicolon_present != -1): + REMOVE_API_NAMES = list(map(str, remove_api_names.split(','))) + else: + REMOVE_API_NAMES = list(map(str, remove_api_names.split())) + for ele in range(len(REMOVE_API_NAMES)): + REMOVE_API_NAMES[ele] = REMOVE_API_NAMES[ele].strip() + + ALL_FILES_IN_MODULE = get_all_files_of_module_list(TC_DIR_PATH, MODULE_NAME) + ALL_HEADER_FILES_IN_MODULE = get_all_header_files_of_module(TC_DIR_PATH, MODULE_NAME) + + check_if_deprecated_tc_exists_in_header_files(TC_DIR_PATH, MODULE_NAME, REMOVE_API_NAMES, ALL_HEADER_FILES_IN_MODULE, REMOVE_TC_LIST, NOT_FOUND_API_LIST) + return REMOVE_TC_LIST, NOT_FOUND_API_LIST + + +def delete_apis_from_header_files(MODULE_NAME, exclude_api_names, TC_DIR_PATH, REMOVE_TC_LIST): + is_semicolon_present = exclude_api_names.find(',') + if(is_semicolon_present != -1): + REMOVE_API_NAMES = list(map(str, exclude_api_names.split(','))) + else: + REMOVE_API_NAMES = list(map(str, exclude_api_names.split())) + for ele in range(len(REMOVE_API_NAMES)): + REMOVE_API_NAMES[ele] = int(REMOVE_API_NAMES[ele].strip()) + + REMOVE_API_NAMES.sort(reverse=True) + for tc_no in REMOVE_API_NAMES: + REMOVE_TC_LIST.pop(tc_no-1) + + + ALL_HEADER_FILES_IN_MODULE = get_all_header_files_of_module(TC_DIR_PATH, MODULE_NAME) + #delete tc occurence in all the header files + for header_file in ALL_HEADER_FILES_IN_MODULE: + for api_name_deprecated in REMOVE_TC_LIST: + command = f"sed -i '/{api_name_deprecated}/d' {TC_DIR_PATH}/{MODULE_NAME}/{header_file}&" + process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) + + ALL_C_FILES_IN_MODULE = get_all_c_files_of_module_list(TC_DIR_PATH, MODULE_NAME) + for files in ALL_C_FILES_IN_MODULE: + delete_tc_from_all_c_files(REMOVE_TC_LIST, MODULE_NAME, files, TC_DIR_PATH) + diff --git a/tool/TC_Assistant_Tool/tct_assistance.py b/tool/TC_Assistant_Tool/tct_assistance.py index 1dd1b9e46..bf837c197 100644 --- a/tool/TC_Assistant_Tool/tct_assistance.py +++ b/tool/TC_Assistant_Tool/tct_assistance.py @@ -32,6 +32,10 @@ from CMakeFileUpdate import * from new_module_addition import * from header_file_location import * from log_debugger import * +from Ko_Lang_Support.translate_lang import * +from Ko_Lang_Support.read_csv_ko import * +from Ko_Lang_Support.get_eng_or_ko import * +from remove_deprecated_api import * import numpy as np import pandas as pd import re @@ -74,7 +78,7 @@ logger = logger_init() # We have prepared a dataset with 7 labels try: - df = pd.read_csv('newdata.csv', encoding='ISO-8859-1') + df = pd.read_csv('tool_dataset.csv', encoding='ISO-8859-1') df.head() except: log_create(logger, "Error occurred while reading dataset file!") @@ -178,15 +182,7 @@ def bar(inp_str): time.sleep(.5) progress['value'] = 100 -# Load intents from json file -log_info_save_processing(logger, "Importing data_TCT.json file") -try: - f = open("data_TCT.json") - data = json.load(f) - -except: - log_create(logger, "Error occurred while importing the json file") @@ -248,6 +244,8 @@ isExist=True callback_duplicate_check = [] def get_response(message): + if radio_var.get() == 2: + message = translate_to_en(message) try: global result global module_name @@ -284,17 +282,37 @@ def get_response(message): global flag_check_negative global isExist global callback_duplicate_check + global REMOVE_TC_LIST + global NOT_FOUND_API_LIST except: log_create(logger, "Variable name error occured") + + # Load intents from json file + log_info_save_processing(logger, "Importing data_TCT.json file") + + try: + # f = open("data_TCT.json") + # data = json.load(f) + if radio_var.get() == 2: + f = open("Ko_Lang_Support/data_TCT_KOR.json") + else: + f = open("data_TCT.json") + data = json.load(f) + + + except: + log_create(logger, "Error occurred while importing the json file") + try: if "pre:" in message.lower() and "yaca" in message.lower(): intent="prepostinfo" else: intent = get_prediction(message) - # print("message ", message) - # print("intent ", intent) + print("message ", message) + print("intent ", intent) + print("previous intent", previous_intent) log_info_save(logger, "Intent", intent) except: log_create(logger, "Error occurred in get_prediction function") @@ -302,7 +320,7 @@ def get_response(message): if intent == "existingmodule" and probs[intent]<0.85: intent = "none" if intent == "greetings" and previous_intent != "entry" and previous_intent != 'goback' and previous_intent != 'after_launch': - result = "invalid response, please try again!!" + result = get_en_or_ko_replies('translate_1', radio_var.get()) else: for i in data['intents']: if i["tag"] == intent: @@ -333,11 +351,21 @@ def get_response(message): return "exit" get_response(msg) - elif previous_intent == "supportsys" and (message == "back" or message == "Back"): + elif previous_intent == "supportsys" and (message == "back" or message == "Back" or message == "in the back"): msg = "support" previous_intent = "goback" get_response(msg) + elif previous_intent == "modulename" and (message == "back" or message == "Back" or message == "in the back"): + msg = "remove api" + previous_intent = "goback" + get_response(msg) + + elif previous_intent == "inputremovalapi" and (message == "back" or message == "Back" or message == "in the back"): + msg = "Module Name: "+ module_name + previous_intent = "removeapi" + get_response(msg) + elif message == 'a' or message == 'b' or message == 'c' or message == 'd' or message == 'e' or message == '' or message == "exit" or message == "EXIT" or message == "Exit": # if previous_intent == "entry": previous_intent = "supportsys" @@ -355,7 +383,6 @@ def get_response(message): return "exit" get_response(msg) - elif message.lower() == 'yes' or message.lower() =='no': #in case when module name typed wrong and suggestion is provided if previous_intent == 'modulename': @@ -370,23 +397,17 @@ def get_response(message): elif previous_intent == 'apiinfo': if message.lower() == 'yes': - result = "Please enter supported features for the above-mentioned APIs, in the form of \nFeature name:" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_2', radio_var.get()) elif message.lower() == 'no': last_stage_index = 3 previous_intent = 'featureinfo' feature_name = '' - result = "Feature details skipped.\n" \ - + "Do you want to add Pre and Post condition APIs for the above APIs?" + "\n" \ - + "(Yes or No)" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_3', radio_var.get()) elif previous_intent =='featureinfo': if message.lower() == 'yes': all_pre_post_api_skip = False - result = "Please enter Pre and Post condition APIs for API: " + f"{API_NAMES[0]}" +" in the format of \nPre: API_NAME_1 API_NAME_2 Post: API_NAME_1 API_NAME_2 separated by space" \ - +"\n\n If you don't want to write pre and post APIs for " + f"{API_NAMES[0]}" + " please write 'Pre:'" \ - +"\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_4', radio_var.get()) + f"{API_NAMES[0]}" +get_en_or_ko_replies('translate_5', radio_var.get()) + f"{API_NAMES[0]}" + get_en_or_ko_replies('translate_6', radio_var.get()) elif message.lower() == 'no': all_pre_post_api_skip = True get_response('Pre:') @@ -398,20 +419,19 @@ def get_response(message): if message.lower() == "yes": if not flag_check_negative: WRITE_NEGATIVE_TC_USER_INPUT = False - result = "Negative TCs not possible for this API, Only positive TCs will be created. \n\n" + result = get_en_or_ko_replies('translate_7', radio_var.get()) else: WRITE_NEGATIVE_TC_USER_INPUT = True - result = "Thank You for providing input. \n" + result = get_en_or_ko_replies('translate_8', radio_var.get()) elif message.lower() == "no": WRITE_NEGATIVE_TC_USER_INPUT = False - result = "Thank You for providing input. Only positive TCs will be created \n" + result = get_en_or_ko_replies('translate_9', radio_var.get()) if new_module == False: - result = result + "All .C TC Code files in the mentioned directory are listed as below \n" \ + result = result + get_en_or_ko_replies('translate_11', radio_var.get()) \ + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "\n\n" \ + get_all_files_of_module(TC_WRITE_DIR, MODULE_NAME) + "\n\n" \ - + "Please provide the file name in which you want to write the TC in the format of \nFILE name: NAME_OF_THE_FILE.c" \ - + "\n\n[ To navigate, please type 'Back' ]" + + get_en_or_ko_replies('translate_12', radio_var.get()) else: msg = "FILE name: utc-" + MODULE_NAME + ".c" get_response(msg) @@ -425,17 +445,29 @@ def get_response(message): if i["tag"] == intent: result = random.choice(i["responses"]) elif message.lower() == "no": - result = 'Do you want to continue for next module ? (Yes/No)' + result = get_en_or_ko_replies('translate_13', radio_var.get()) previous_intent = 'after_launch' + elif previous_intent == "inputremovalapi": + if message.lower() == "yes": + # MODULE_NAME = module_name.lower() + CURRENT_PATH = get_current_dir_path() + TC_DIR_PATH = CURRENT_PATH + r'src/utc/' + # REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH) + delete_apis_from_header_files(MODULE_NAME, '', TC_DIR_PATH, REMOVE_TC_LIST) + result = "Above mentioned TCs have been removed successfully. Type 'EXIT' to close the tool." + elif message.lower() == "no": + result = "Please enter the serial no. of TC which is not to be removed in the form of EXCLUDE: 1\n\n* If more than one TCs not to remove then mention the serial no as comma separated in the form of EXCLUDE: 1,2,3\n\n[ To exit the tool, please type 'Exit' ]" #ask a question to execute or not elif previous_intent == 'executetc': + print("inside elif executetc ", message.lower()) if message.lower() == 'yes': + print("inside elif executetc yes") intent = 'launchtctmgr' elif message.lower() == "no": - result = 'Do you want to continue for next module ? (Yes/No)' + result = get_en_or_ko_replies('translate_13', radio_var.get()) previous_intent = 'after_launch' @@ -466,29 +498,34 @@ def get_response(message): last_stage_index = 1 module_check = module_autocorrect(module_name) if module_check == True: - result = "Module name already exists. Please write module name apart from existing one.\n" + "Please provide module name in the form of \nModule name:" + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_14', radio_var.get()) previous_intent = 'modulename' elif module_name=='': - result = "No Module name details entered!! \n\n Please provide Module name in the format of \n Module name:\n\n [ To navigate, please type 'Back' ] " + result = get_en_or_ko_replies('translate_15', radio_var.get()) elif module_check != True and previous_intent!="goback": - result = "Please enter Header file details in the format of \nHeader File: HEADER_FILE_1 HEADER_FILE_2" + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_16', radio_var.get()) previous_intent = 'modulename' elif module_check != True and previous_intent == "goback": - result = "Please enter Header file details in the format of \nHeader File: HEADER_FILE_1 HEADER_FILE_2" + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_16', radio_var.get()) previous_intent = 'modulename' else: - previous_intent = 'modulename' + # previous_intent = 'modulename' module_name_suggested = module_autocorrect(module_name) if module_name_suggested == True: last_stage_index = 1 - result = "Module name found" + "\n" + result + if previous_intent == "removeapi": + result = "Module name found" + "\n" + "Please enter the list of deprecated APIs which you want to be removed in the format of DELETE: API_NAME_1, API_NAME_2, API_NAME_3, etc.\n\n[ To navigate, please type 'Back' ]" + previous_intent = 'modulename' + else: + result = "Module name found" + "\n" + result + previous_intent = 'modulename' elif module_name_suggested != '': - result = "Module name not found[Please check mapping file: Module_Header_Mapping.csv]" + "\n" + "\n" + "Did you mean ? " + module_name_suggested[0] + "\n" + "Type Yes to continue otherwise type No" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_17', radio_var.get()) + module_name_suggested[0] + "\n" + get_en_or_ko_replies('translate_18', radio_var.get()) module_name = module_name_suggested[0] + previous_intent = 'modulename' else: - result = "Module name not found[Please check mapping file: Module_Header_Mapping.csv], \n\nPlease type the module name again in the form of \nModule name:" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_19', radio_var.get()) + previous_intent = 'modulename' elif intent == 'headerinfo': new_module = True @@ -511,7 +548,7 @@ def get_response(message): if HEADER_FILE_LOCATION == "": - result = "Header file not found in rootstrap! So, Module not created.\nPlease enter the correct header file details in the form of form of \nHeader File:" + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_20', radio_var.get()) else: #add a new module type_of_tc = "utc" @@ -522,9 +559,9 @@ def get_response(message): clean_existing_code(TC_WRITE_DIR, module_name) add_header_line(TC_WRITE_DIR, module_name, HEADER_FILES_NAMES_TO_UPDATE) update_module_mapper_file(HEADER_FILE_VALUE, module_name) - result = "Please provide API information in the format of \nAPI names: API_NAME_1 API_NAME_2 \n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_21', radio_var.get()) else: - result= "No Header File details entered!! \n\n Please provide Header File details in the format of \n Header File :\n\n [ To navigate, please type 'Back' ] " + result= get_en_or_ko_replies('translate_22', radio_var.get()) @@ -553,7 +590,10 @@ def get_response(message): for API_SEARCH in API_NAMES: if check_if_api_exists_grep(MODULE_NAME, API_SEARCH, TC_WRITE_DIR): clear_api_list() - return "ThankYou for providing input." + "\n" + "TC already exists for API: " + API_SEARCH + "\n" + "Please try writing again." + "\n\n[ To navigate, please type 'Back' ]" + result_next = get_en_or_ko_replies('translate_23', radio_var.get()) + API_SEARCH + "\n" + get_en_or_ko_replies('translate_24', radio_var.get()) + if radio_var.get() == 2: + result_next = translate_to_ko(result_next) + return result_next api_return_values = get_api_return_values() # print("api_return_values", api_return_values) @@ -577,32 +617,29 @@ def get_response(message): last_stage_index = 2 previous_intent = 'apiinfo' - result = "Thankyou, APIs found in rootstrap.\n" \ - + "Do you want to add Feature for above APIs?" + "\n" \ - + "(Yes or No)" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_25', radio_var.get()) else: if isExist: - top_msg_display = "APIs not present in rootstraps. Please try writing again." + "\n\n" + "All the APIs present in the header file are mentioned below for your reference:" + top_msg_display = get_en_or_ko_replies('translate_26', radio_var.get()) result = "" for HEADER_FILE_NAME in header_files_dict: if "/" in HEADER_FILE_NAME: POS_OF_SLASH = HEADER_FILE_NAME.index("/") HEADER_FILE_NAME_WITHOUT_SLASH = HEADER_FILE_NAME[POS_OF_SLASH+1:] - temp = "\n\n" + "Header File Name: " + HEADER_FILE_NAME_WITHOUT_SLASH + "\n\n" +get_all_api_names(MODULE_NAME, HEADER_FILE_NAME) + temp = "\n\n" + get_en_or_ko_replies('translate_27', radio_var.get()) + HEADER_FILE_NAME_WITHOUT_SLASH + "\n\n" +get_all_api_names(MODULE_NAME, HEADER_FILE_NAME) result = result + temp else: - temp = "\n\n" + "Header File Name: " + HEADER_FILE_NAME + "\n\n" +get_all_api_names(MODULE_NAME, HEADER_FILE_NAME) + temp = "\n\n" + get_en_or_ko_replies('translate_27', radio_var.get()) + HEADER_FILE_NAME + "\n\n" +get_all_api_names(MODULE_NAME, HEADER_FILE_NAME) result = result + temp - result = top_msg_display + result + "\n\n\nPlease provide API information in the format of \nAPI names:" + "\n\n[ To navigate, please type 'Back' ]" + result = top_msg_display + result + get_en_or_ko_replies('translate_28', radio_var.get()) + get_en_or_ko_replies('translate_55', radio_var.get()) clear_api_list() else: - result="Header File not found in rootstrap, Please check Module_Header_Mapping.csv" + result=get_en_or_ko_replies('translate_29', radio_var.get()) else: - result = "No API details entered !!" + "\n\nPlease provide API information in the format of \nAPI names:" + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_30', radio_var.get()) elif intent == 'featureinfo': last_stage_index = 3 @@ -624,9 +661,7 @@ def get_response(message): feature_name = feature_name.strip() - result = "Do you want to add Pre and Post condition APIs for the above APIs?" + "\n" \ - + "(Yes or No)" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_31', radio_var.get()) elif feature_name == "" and previous_intent == 'goback': previous_intent = 'featureinfo' @@ -644,13 +679,10 @@ def get_response(message): feature_name = feature_name.strip() - result = "Do you want to add Pre and Post condition APIs for the above APIs?" + "\n" \ - + "(Yes or No)" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_31', radio_var.get()) else: - result = "No Feature details entered!!\n\nPlease enter supported features for the above-mentioned APIs, in the form of \nFeature name:" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_32', radio_var.get()) elif intent == 'prepostinfo': @@ -662,65 +694,41 @@ def get_response(message): NEGATIVE_TC_COUNT = 10 last_stage_index = 4 - # get_pre_post_api_list_info(API_NAMES, MODULE_NAME, pre_post_api_names) - #CURR_API_IND = 0 - ## print("api length", API_NAMES) - ## print("curr_api_ind", CURR_API_IND) if CURR_API_IND < len(API_NAMES): - ## print("curr_api_index", CURR_API_IND) - ### print("Current value of current index") - ### print(CURR_API_IND) get_pre_post_api_list = get_pre_post_api_list_info(API_NAMES[CURR_API_IND], MODULE_NAME, CURR_API_IND , pre_post_api_names) - # print("looooooogsssssss",get_pre_post_api_list) check_if_pre_post_api_exist &= (validate_api(get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Pre'], MODULE_NAME) and validate_api(get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Post'], MODULE_NAME)) - # print("check_if_pre_post_api_exist",check_if_pre_post_api_exist) - #pre_post_enum = enum_finder_for_pre_post(get_pre_post_api_list, ROOTSTRAPS_DIR, header_files_dict, api_params) - ## print('afasdfgdsafsdaf',get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Pre']) API_NAMES_LIST += get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Pre'] + get_pre_post_api_list[API_NAMES[CURR_API_IND]]['Post'] - # print(API_NAMES_LIST) - ## print("CURR_API_IND",CURR_API_IND) - ## print("length",len(API_NAMES)) if CURR_API_IND < len(API_NAMES): #for case when pre and post are not to be entered by user. User has selected no if all_pre_post_api_skip == True: CURR_API_IND = CURR_API_IND + 1 - # print("inside CURR_API_IND + 1 < len(API_NAMES) and get_response called again",CURR_API_IND) - ## print("API_NAMES[CURR_API_IND]",API_NAMES[CURR_API_IND-1]) - ## print("API_NAMES[CURR_API_IND+1]",API_NAMES[CURR_API_IND]) CURR_API_IND = len(API_NAMES) for API_IDX in range(1, len(API_NAMES)): get_pre_post_api_list = get_pre_post_api_list_info(API_NAMES[API_IDX], MODULE_NAME, API_IDX , pre_post_api_names) - # print("get_pre_post_api_list",get_pre_post_api_list) API_NAMES_LIST += get_pre_post_api_list[API_NAMES[API_IDX]]['Pre'] + get_pre_post_api_list[API_NAMES[API_IDX]]['Post'] # print("API_NAMES_LIST",API_NAMES_LIST) # get_response('Pre:') else: if (CURR_API_IND+1) 0: HEADER_FILE_NAME = HEADER_FILE_NAME[pos+1:] for API_IDX in range(len(API_NAMES)): - # print("details of each API", API_IDX) - # print("for api ---", API_NAMES[API_IDX]) - # print("looooooogsssssss",get_pre_post_api_list) PRE_POST_API_LIST = get_pre_post_api_list[API_NAMES[API_IDX]] - # print("cjeclomg dlfm", PRE_POST_API_LIST) pre_apis = PRE_POST_API_LIST['Pre'] - ## print("pre_apis",pre_apis) post_apis = PRE_POST_API_LIST['Post'] if len(pre_apis) != 0: for pre_api in pre_apis: api_params_pre = PRE_POST_API_ARGS_LIST[pre_api] - ## print("api_params",api_params_pre) enum = enum_finder(pre_api, ROOTSTRAPS_DIR, header_files_dict, api_params_pre) if enum != {}: - ## print("enum found") enum_dict_pre_post[pre_api] = enum else: - ## print("enum not found for pre API!") enum_dict_pre_post[pre_api] = {} if len(post_apis) != 0: for post_api in post_apis: api_params_post = PRE_POST_API_ARGS_LIST[post_api] - ## print("api_params_post", api_params_post) enum = enum_finder(post_api, ROOTSTRAPS_DIR, header_files_dict, api_params_post) - ## print("post_api_detail ->", post_api) - #post_key = "Pre-" + API_NAMES[API_IDX] + "- " + post_api if enum != {}: - # print("enum found") enum_dict_pre_post[post_api] = enum else: - # print("enum not found for pre API!") enum_dict_pre_post[post_api] = {} - ## print("enum pre post dict for API - ", enum_dict_pre_post) - - ## print("Header file name checking", HEADER_FILE_NAME) HEADER_FILE_CONTAINED_FOLDER = get_api_header_file_contained_folder_name(ROOTSTRAPS_DIR, HEADER_FILE_NAME) HEADER_FILE_CONTAINED_FOLDER = HEADER_FILE_CONTAINED_FOLDER.replace('-','_') - ## print("Header file contained folder", HEADER_FILE_CONTAINED_FOLDER) - ## print("API_NAMES[API_IDX]",API_NAMES[API_IDX]) - ## print("PRE_POST_API_LIST", PRE_POST_API_LIST) - ## print("PRE_POST_API_ARGS_LIST",PRE_POST_API_ARGS_LIST) - ## print("FUNC_API_ALL_ARGS[API_IDX]",FUNC_API_ALL_ARGS[API_IDX]) - ## print("HEADER_FILE_CONTAINED_FOLDER",HEADER_FILE_CONTAINED_FOLDER) - ## print("enum_dict",enum_dict) - ## print("enum_dict_pre_post",enum_dict_pre_post) - ## print("feature_name",feature_name) - # print("RET_TYPE ", RET_TYPE) + get_tc_template_code = tc_code_write1(get_all_api_list, MODULE_NAME, API_NAMES[API_IDX], PRE_POST_API_LIST, PRE_POST_API_ARGS_LIST, FUNC_API_ALL_ARGS[API_IDX], HEADER_FILE_CONTAINED_FOLDER, enum_dict, enum_dict_pre_post, feature_name, callback_duplicate_check) ## print("get_tc_template_code",get_tc_template_code) appended_code = appended_code + "\n" + get_tc_template_code - ## print("tc_code from tct_assistance ") - # print(appended_code) - # code, NO_OF_NEGATIVE_TC = all_negative_tc_combined(RET_TYPE, MODULE_NAME, API_NAMES[API_IDX], PRE_POST_API_LIST, PRE_POST_API_ARGS_LIST, FUNC_API_ALL_ARGS[API_IDX], HEADER_FILE_CONTAINED_FOLDER, NEGATIVE_TC_COUNT) - #appended_negative_tc_code = appended_negative_tc_code + appended_code - # print("TARGET_API_INPUT_PARAMS_LIST",TARGET_API_INPUT_PARAMS_LIST) + if len(TARGET_API_INPUT_PARAMS_LIST) > 0: appended_negative_tc_code = appended_negative_tc_code + get_tc_template_code + "\n" + all_negative_tc_combined(get_all_api_list, MODULE_NAME, API_NAMES[API_IDX], PRE_POST_API_LIST, PRE_POST_API_ARGS_LIST, FUNC_API_ALL_ARGS[API_IDX], HEADER_FILE_CONTAINED_FOLDER, 10, feature_name, enum_dict, enum_dict_pre_post) + "\n" flag_check_negative = True input_params.append(len(TARGET_API_INPUT_PARAMS_LIST)) TARGET_API_INPUT_PARAMS_LIST.clear() - # print("inputdsfsadfds_params",input_params) elif len(TARGET_API_INPUT_PARAMS_LIST) == 0: input_params.append(0) appended_negative_tc_code = appended_negative_tc_code + get_tc_template_code @@ -807,12 +785,10 @@ def get_response(message): previous_intent = 'prepostinfo' last_stage_index = 4 if all_pre_post_api_skip == True: - result = "Pre and Post condition skipped.\n\n" + result = get_en_or_ko_replies('translate_38', radio_var.get()) else: - result = "Thank You for providing pre/post condition APIs. \n\n" - result = result + "Do you want to add negative TCs also?" + "\n" \ - + "(Yes or No)" \ - + "\n\n[ To navigate, please type 'Back' ]" + result = get_en_or_ko_replies('translate_39', radio_var.get()) + result = result + get_en_or_ko_replies('translate_40', radio_var.get()) elif check_if_pre_post_api_exist == False: CURR_API_IND = CURR_API_IND - 1 @@ -828,8 +804,7 @@ def get_response(message): API_NAMES_LIST.remove(i) break - result = "Pre/Post condition APIs provided by you does not exists." \ - + "\n\n[ Please type 'Back' and provide all Pre/Post APIs data again. ]" + result = get_en_or_ko_replies('translate_41', radio_var.get()) elif intent == 'tcwritelocation': #write tc in the mentioned file name collected from the user @@ -849,105 +824,116 @@ def get_response(message): #inp_params=ret_input_params() with open(TC_WRITE_DIR + "/" + MODULE_NAME + "/" + f"{file_name}", "a") as myfile: if WRITE_NEGATIVE_TC_USER_INPUT: - # print("writing neg and pos tc") - ## print("get_negative_tc_template_code",get_negative_tc_template_code) - ## print(get_negative_tc_template_code) myfile.write(get_negative_tc_template_code) else: - # print("printing pos tc") - ## print(get_tc_template_code) myfile.write(get_tc_template_code) # code for making entry of new tc in header files if a new file is created for API_IDX in range(len(API_NAMES)): - # print("API_NAMES",API_NAMES) - # print("TC_WRITE_DIR",TC_WRITE_DIR,"MODULE_NAME",MODULE_NAME,"HEADER_FILE_CONTAINED_FOLDER",HEADER_FILE_CONTAINED_FOLDER,"filename",file_name) update_all_header_files(TC_WRITE_DIR, MODULE_NAME, HEADER_FILE_CONTAINED_FOLDER, API_NAMES[API_IDX], file_name, True) # if user type yes when asked for negative TCs then update negative tc in header files if WRITE_NEGATIVE_TC_USER_INPUT: inp_params = ret_input_params() - # print("API_IDX",API_IDX) - # print("inp_params",inp_params) if inp_params!=[]: for idx in range(1, inp_params[API_IDX]+1): update_all_header_files_for_negative_tc(TC_WRITE_DIR, MODULE_NAME, HEADER_FILE_CONTAINED_FOLDER, API_NAMES[API_IDX], idx, API_IDX,file_name) if new_module == True: - result = result + "TC is created successfully at path : " + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + "Do you want to build ?\n(Yes or No)" + result = result + get_en_or_ko_replies('translate_42', radio_var.get()) + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + get_en_or_ko_replies('translate_43', radio_var.get()) else: - result = "Thankyou, for providing file name.\n" + "TC is created successfully at path : " + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + "Do you want to build ?\n(Yes or No)" + result = get_en_or_ko_replies('translate_44', radio_var.get()) + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + get_en_or_ko_replies('translate_45', radio_var.get()) else: - # print("MODULE_NAME,file_name,header_files_dict",MODULE_NAME,file_name,header_files_dict) get_tc_init_code = tc_code_init(MODULE_NAME,file_name,header_files_dict) - # print("filename----",file_name) with open(TC_WRITE_DIR + "/" + MODULE_NAME + "/" + f"{file_name}", "a+") as myfile: myfile.write(get_tc_init_code) if WRITE_NEGATIVE_TC_USER_INPUT: - # print("writing neg and pos tc for new file") - # print(get_negative_tc_template_code) myfile.write(get_negative_tc_template_code) else: - # print("writing only pos tc for a new file") - # print(get_tc_template_code) myfile.write(get_tc_template_code) # code for making entry of new tc in header files if a new file is created for API_IDX in range(len(API_NAMES)): - ### print("reprint 1") inp_params=[] update_all_header_files(TC_WRITE_DIR, MODULE_NAME, HEADER_FILE_CONTAINED_FOLDER, API_NAMES[API_IDX], file_name, False) # if user type yes when asked for negative TCs then update negative tc in header files if WRITE_NEGATIVE_TC_USER_INPUT: - ## print("API INDEX", API_IDX) inp_params = ret_input_params() - # print("input params", inp_params) if inp_params!=[] and API_IDX <= (len(inp_params) -1): for idx in range(1, inp_params[API_IDX]+1): - # print("idx", idx) - # print("API NAMES", API_NAMES) - # print("\n API names of index is ", API_NAMES[API_IDX]) update_all_header_files_for_negative_tc(TC_WRITE_DIR, MODULE_NAME, HEADER_FILE_CONTAINED_FOLDER, API_NAMES[API_IDX], idx, API_IDX,file_name) - # print("updating CMakelist file for new tc file created") - # print(TC_WRITE_DIR) - # print(file_name) + updateCMakeFile(TC_WRITE_DIR, MODULE_NAME, file_name) - result = "Thankyou, for providing file name." + "A new file will be created at path : " + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + "Do you want to build ?\n(Yes or No)" + result = get_en_or_ko_replies('translate_46', radio_var.get()) + f"{TC_WRITE_DIR}" + "/" + f"{MODULE_NAME}" + "/" + f"{file_name}" + "\n\n" + get_en_or_ko_replies('translate_47', radio_var.get()) + + else: + result=get_en_or_ko_replies('translate_48', radio_var.get()) + + elif intent == 'removeapi': + previous_intent = 'removeapi' + result = "Please provide module name for which you want to remove TCs in the form of \nModule name: NAME_OF_THE_MAIL\n\n[ To navigate, please type 'Back' ]" + elif intent == 'inputremovalapi': + previous_intent = 'inputremovalapi' + pos_of_semicolon = [_.start() for _ in re.finditer(":", message)] + remove_api_names = message[pos_of_semicolon[0]+1:] + MODULE_NAME = module_name.lower() + CURRENT_PATH = get_current_dir_path() + TC_DIR_PATH = CURRENT_PATH + r'src/utc/' + # print("Above mentioned APIs will be removed" + "\n\n" + deprecated_api_removal(MODULE_NAME, remove_api_names)) + REMOVE_TC_LIST, NOT_FOUND_API_LIST = deprecated_api_removal(MODULE_NAME, remove_api_names, TC_DIR_PATH) + REMOVE_TC_LIST_NUMBERED = "" + NOT_FOUND_API_LIST_NUMBERED = "" + for i, item in enumerate(REMOVE_TC_LIST, start=1): + REMOVE_TC_LIST_NUMBERED += f"{i}. {item}" + "\n" + for i, item in enumerate(NOT_FOUND_API_LIST, start=1): + NOT_FOUND_API_LIST_NUMBERED += f"{i}. {item}" + "\n" + + if len(REMOVE_TC_LIST) == 0: + result = "TCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\n[ To navigate, please type 'Back' ]" + elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) == 0: + result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]" + elif len(REMOVE_TC_LIST) > 0 and len(NOT_FOUND_API_LIST) > 0: + result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]" else: - result="File name details not entered!! \n\n Please provide file name in the format of \nFile name:\n\n [ To navigate, please type 'Back' ]" + result = "Above mentioned TCs will be removed. Please find TCs detail for these APIs as below:\n\n" + f"{REMOVE_TC_LIST_NUMBERED}" + "\n\nTCs not found for the below APIs (Please remove these not found TCs manually)\n\n" + f"{NOT_FOUND_API_LIST_NUMBERED}" + "\n\nIf above TCs information is correct then type 'YES' to remove them otherwise 'NO'" + "\n\n[ To navigate, please type 'Back' ]" + + elif intent == 'donotremove': + previous_intent = 'donotremove' + pos_of_semicolon = [_.start() for _ in re.finditer(":", message)] + exclude_api_names = message[pos_of_semicolon[0]+1:] + MODULE_NAME = module_name.lower() + CURRENT_PATH = get_current_dir_path() + TC_DIR_PATH = CURRENT_PATH + r'src/utc/' + delete_apis_from_header_files(MODULE_NAME, exclude_api_names, TC_DIR_PATH, REMOVE_TC_LIST) + result = "APIs removed successfully. Type 'Exit' to close the tool." elif intent == 'executetc': MODULE_NAME = module_name previous_intent = "executetc" execute_tc_params_text = message - # print("execute_tc_params_text", execute_tc_params_text) build_params = get_build_parameters(message) - # print("params", build_params) arch_value = build_params[0].lower() - # print(arch_value) profile_value = build_params[1].lower() - # print(profile_value) if (arch_value == "armv7l" or arch_value == "x86" or arch_value == "x64" or arch_value == "aarch64") and (profile_value == "tv" or profile_value == "tizeniot"): - # print("build params are correct") - bar("Build Started !! Please wait...") + bar(get_en_or_ko_replies('translate_49', radio_var.get())) output_build = tpk_build_install("build", "utc", MODULE_NAME, build_params[1], build_params[0]) # time.sleep(3) if output_build.find("CREATION SUCCESSFUL") != -1: if previous_intent == 'executetc': style.configure("text.Horizontal.TProgressbar", text="",background="lightgray",foreground="lightgray", font=("Malgun Gothic", 10, 'bold')) base.update() - result = "Build completed successfully" + "\n\n" + "Do you want to execute TCs?" + "\n" + "(Yes or No)" + result = get_en_or_ko_replies('translate_51', radio_var.get()) else: - result = "Build Failed, Please check the TC file and try again." + result = get_en_or_ko_replies('translate_52', radio_var.get()) print(output_build) else: - result = "Build parameters values are not correct" + "\n" + "Please try again.." + result = get_en_or_ko_replies('translate_53', radio_var.get()) - elif intent == "launchtctmgr": - # print("inside launchtctmgr intent") + if intent == "launchtctmgr": + print("inside launchtctmgr intent") bar("Installing...") execute_params = get_build_parameters(execute_tc_params_text) output_execute = tpk_build_install("install", "utc", MODULE_NAME, execute_params[1], execute_params[0]) @@ -955,7 +941,7 @@ def get_response(message): base.update() open_tct_mgr() previous_intent="after_launch" - result = "Installing the package..." + "Make sure the target is connected" "\n" + "Launching TCT-MGR tool" "\n\n" + "Do you want to continue for another module?" + result = get_en_or_ko_replies('translate_54', radio_var.get()) print(output_execute) @@ -965,25 +951,20 @@ def get_response(message): print("^^^^^^^^^^^^^^^^^^^^^^^^") print(build_log_debug(build_log)) build_fail_reason = build_log_debug(build_log) - result = build_fail_reason + "\n\n [ To navigate, please type 'Back' ]" + result = build_fail_reason + get_en_or_ko_replies('translate_55', radio_var.get()) elif intent == "goback": - # print("checking new module value from goback", new_module) - # print("Going back\n") - # print("previous stage is ", last_stage_index) - # print("previous result was: ") - # print(result) if last_stage_index == 6: - result = "You can't go back at this stage. Please write the appropriate inputs" + result = get_en_or_ko_replies('translate_56', radio_var.get()) else: previous_intent = "goback" ind = 0 - result = "Please select numbers for the corresponding stage you want to go to:\n" + result = get_en_or_ko_replies('translate_57', radio_var.get()) while ind <= last_stage_index and ind < 6: result = result + str(ind+1) + ". " + stage_list[ind] + "\n" ind = ind + 1 - result = result + "\n\n" + "If you wish to EXIT, Please type Exit" + result = result + "\n\n" + get_en_or_ko_replies('translate_58', radio_var.get()) except KeyboardInterrupt: print('Interrupted') @@ -994,8 +975,9 @@ def get_response(message): os._exit(130) except: log_create(logger, "Error occurred in get_prediction function") - return "Invalid Input. Please try writing again" - + if radio_var.get() == 2: + result_next = translate_to_ko("Invalid Input. Please try writing again") + return result_next return result @@ -1061,11 +1043,9 @@ def send(event=None): EntryBox.delete("0.0",END) if msg != '': - # print("msg ############", msg) if '\n' in msg: msg = msg.replace('\n','') msg = msg.replace('\t','') - # print("msg after ############", msg) log_info_save(logger, "YOU", msg) ChatLog.config(state=NORMAL) @@ -1154,6 +1134,32 @@ def on_closing(): if response=="Yes": base.destroy() +def radiobutton_event(): + print("radiobutton toggled, current value:", radio_var.get()) + # child_info = base.winfo_children() + # print(child_info) + print("ChatLog.winfo_children()", ChatLog.winfo_children()) + for child in ChatLog.winfo_children(): + if child.widgetName == "frame": + child.destroy() + ChatLog.delete('0.0', END) + if radio_var.get() == 2: + Bot.destroy() + welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" + welcomeText = translate_to_ko(welcomeText) + Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") + # ChatLog.insert('end', '\n ') + ChatLog.window_create('end', window=Bot_ko) + ChatLog.insert(END, '\n') + elif radio_var.get() == 1: + Bot.destroy() + welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" + Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") + # ChatLog.insert('end', '\n ') + ChatLog.window_create('end', window=Bot_ko) + ChatLog.insert(END, '\n') + return radio_var.get() + CURRENT_PATH = get_current_dir_path() CURRENT_PATH_IMG = get_current_dir_path_for_image() @@ -1169,14 +1175,17 @@ center(base) ChatLog = Text(base, bd=0, relief=FLAT, bg='#d3d3d3', highlightthickness=0, font="Arial",wrap=WORD) ChatLog.pack(fill=BOTH, expand=True) -welcomeText = "Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n" +welcomeText = "Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n" log_info_save(logger, "Assitant", welcomeText) +radio_var = tkinter.IntVar(value=0) Bot = customtkinter.CTkLabel(ChatLog,text="Assistant: "+welcomeText, justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2") ChatLog.insert('end', '\n ') ChatLog.window_create('end', window=Bot) ChatLog.insert(END, '\n') +# Bot.after(1, Bot.destroy()) + ChatLog.config(state=DISABLED) @@ -1193,6 +1202,14 @@ EntryBox.pack() copyrightText = customtkinter.CTkLabel(base,text='Copyright (c) 2023 Samsung Electronics Co., Ltd.',justify='right',padx=4) helpButton = customtkinter.CTkButton(base,text='Help',width=115,fg_color='#757575',hover_color="#343434",text_color='white',command= helpText) +englishButton = customtkinter.CTkButton(base,text='En',width=35,fg_color='#757575',hover_color="#343434",text_color='white',command= helpText) +koreanButton = customtkinter.CTkButton(base,text='Ko',width=35,fg_color='#757575',hover_color="#343434",text_color='white',command= helpText) + +radiobutton_1 = customtkinter.CTkRadioButton(base, text="En", + command=radiobutton_event, variable= radio_var, value=1, width=55) +radiobutton_2 = customtkinter.CTkRadioButton(base, text="Ko", + command=radiobutton_event, variable= radio_var, value=2, width=55) +radiobutton_1.select() ChatLog.yview(END) scrollbar.place(x=576, y=22) @@ -1201,6 +1218,8 @@ EntryBox.place(x=6, y=690) SendButton.place(x=470, y=688) copyrightText.place(x=6, y=770) helpButton.place(x=470,y=765) +radiobutton_1.place(x=350,y=765) +radiobutton_2.place(x=405,y=765) progress.place(width=150) progress.pack(fill=X, ipady=2) base.bind('',send) @@ -1208,5 +1227,5 @@ base.protocol("WM_DELETE_WINDOW", on_closing) base.bind_all("", _on_mousewheel) EntryBox.bind("", select_all) EntryBox.bind("", select_all) -base.bind('', quit) +# base.bind('', quit) base.mainloop() diff --git a/tool/TC_Assistant_Tool/template_tc.py b/tool/TC_Assistant_Tool/template_tc.py index ebd8232f6..1f0ddfb67 100644 --- a/tool/TC_Assistant_Tool/template_tc.py +++ b/tool/TC_Assistant_Tool/template_tc.py @@ -11,21 +11,6 @@ callback_duplicate_check = [] TARGET_API_INPUT_PARAMS_LIST = [] Module_name_new ="" -tc_code_inti = """/** - * @testcase utc_bluetooth_bt_initialize_p - * @since_tizen 8_0 - * @description - * @scenario - */ -int utc_bluetooth_bt_initialize_p(void) -{ - int ret = bt_initialize(); - assert_eq(ret, BT_ERROR_NONE); - - return 0; -}""" - - def check_if_str_or_int(inp_string): if "char" in inp_string: # return "test" if string @@ -40,12 +25,6 @@ def check_if_str_or_int(inp_string): return "None" def iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_dict, enum_dict_pre_post): - # all_comb_args_set = ["const char interface", "const char service_type", "dnssd_service_h dnssd_service", "const char service_name", "unsigned int service_int"] - # inp_out_params_list_updated = input_output_params_extract("nsd", "nsd/dns-sd-internal.h", "dnssd_create_remote_service", inp_out_params_list_updated) - # inp_out_params_list_updated = input_output_params_extract("nsd", "nsd/dns-sd-internal.h", "dnssd_destroy_remote_service", inp_out_params_list_updated) - ## print(inp_out_params_list_updated) - ## print(check_if_param_is_in_or_out(inp_out_params_list_updated)) - #enum_dict = {'dnssd_service_set_interface': {'webrtc_state_e': 'WEBRTC_ERROR_PERMISSION_DENIED'}, 'webrtc_get_state': {'webrtc_state_e': 'WEBRTC_STATE_IDLE'}} check_if_param_is_in_or_out_dict = check_if_param_is_in_or_out(inp_out_params_list_updated) store_last_word_of_args = [] for pos, ele in enumerate(all_comb_args_set): @@ -81,9 +60,7 @@ def iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_d del all_comb_args_set[pos] else: all_comb_args_set[pos] = ele - ## print("all combs args set") - ## print(all_comb_args_set) - ## print("storing", store_last_word_of_args) + store_last_word_of_args1 = store_last_word_of_args[0:pos+1] if ele.split()[-1] in store_last_word_of_args1: all_comb_args_set.remove(all_comb_args_set[pos]) @@ -96,23 +73,15 @@ def iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_d all_comb_args_set.remove(i) for pos, i in enumerate(all_comb_args_set): - # print("reached till here tc_code4 part 0") - # print(all_comb_args_set) if i != "" and i != "void": variable_name = i.split(" ")[1] datatype_name = i.split(" ")[0] - # print("var name", variable_name) - # print("data name", datatype_name) variable_name_without_ptr = variable_name.replace("*","") - # print("var name without ptr", variable_name_without_ptr) flag = 0 flag_pre_post = 0 - # print("reached till here tc_code4 part 1",enum_dict) for ele, val in enum_dict.items(): - # print("entered", ele, val) for ele1, val1 in val.items(): - # print("entered1", ele1, val1) if ele1 in i: if variable_name_without_ptr in check_if_param_is_in_or_out_dict: if check_if_param_is_in_or_out_dict[variable_name_without_ptr] == "out": @@ -122,12 +91,11 @@ def iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_d break if flag == 1: break - # print("reached till here tc_code4 part 2",enum_dict_pre_post) + if "=" not in all_comb_args_set[pos]: for ele, val in enum_dict_pre_post.items(): - # print("entered inside pre post api", ele, val) for ele1, val1 in val.items(): - # print("entered1 inside pre post api", ele1, val1) + if ele1 in i: if variable_name_without_ptr in check_if_param_is_in_or_out_dict: if check_if_param_is_in_or_out_dict[variable_name_without_ptr] == "out": @@ -137,44 +105,18 @@ def iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_d break if flag == 1: break - # print("reached till here tc_code4 part 3") - # print("all arguments sequential ", i) + if i == "void" or i == "void;" or i == "" or i == " ": all_comb_args_set.remove(i) - # # print("all_comb_args_set => ", all_comb_args_set) - # print("alllll_comb_argsssssss",all_comb_args_set) + tc_code4 = ( f" {k};" "\n" for k in all_comb_args_set) - # print(tc_code4) return ''.join(tc_code4) - - -def tc_code_write(RET_TYPE, MODULE_NAME, API_NAMES, FUNC_ARGS): - tc_code = ( - "/**\n" - f"* @testcase utc_{API_NAMES}_p\n" - "* @since_tizen 8_0\n" - "* @description \n" - "* @scenario \n" - "*/\n" - f"{RET_TYPE} utc_{API_NAMES}_p(void)\n" - "{\n" - " int ret;\n" - - f" ret = {API_NAMES}({FUNC_ARGS.replace('*', '&')});\n" - f" assert_eq(ret, TIZEN_ERROR_NONE);\n" - - " return 0;\n" - "}\n" - ) - - return tc_code - def concat_params1(v): FUNC_ARGS = "" FUNC_ARGS = v[0].split()[-1] @@ -189,10 +131,7 @@ def concat_params1(v): def list_target_api_in_params(API_NAME, check_if_param_is_in_or_out_dict, inp_out_params_list_updated): TARGET_API_INPUT_PARAMS_LIST.clear() if API_NAME in inp_out_params_list_updated: - #if len(inp_out_params_list_updated)>0: in_out_array = inp_out_params_list_updated[API_NAME] - # print("in_out_array",in_out_array) - ## print("inp_out_params_list_updated[API_NAME]",inp_out_params_list_updated[API_NAME]) for ele in in_out_array: for key, val in ele.items(): if val == 'in' and "_cb" not in key and 'user_data' not in key: @@ -203,29 +142,12 @@ def list_target_api_in_params(API_NAME, check_if_param_is_in_or_out_dict, inp_ou def concat_params(CURR_API, v, check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB): FUNC_ARGS = "" - # print("CURR_API", CURR_API) - # print("check_if_param_is_in_or_out_dict", check_if_param_is_in_or_out_dict) - # print("inp_out_params_list_updated[CURR_API]", inp_out_params_list_updated) - # print("inp_out_params_list_updated[CURR_API]", inp_out_params_list_updated[CURR_API]) - # print("inp_out_params_list_updated", inp_out_params_list_updated) COMBINED_API_ARGS_DICT_CB = PRE_POST_API_ARGS_LIST.copy() - # print("PRE_POST_API_ARGS_LIST", PRE_POST_API_ARGS_LIST) - # print("TARGET_API_ARGS", TARGET_API_ARGS) - # print("TARGET_API_NAME_CB", TARGET_API_NAME_CB) COMBINED_API_ARGS_DICT_CB[TARGET_API_NAME_CB] = TARGET_API_ARGS - # print("COMBINED_API_ARGS_DICT_CB", COMBINED_API_ARGS_DICT_CB) - # print(v) - # print("inp_out_params_list_updated inside concat_params", inp_out_params_list_updated) - # print("all_callback_args inside concat_params", all_callback_args) for j in range(0, len(v)): - # print("j",j) - # print("(v[j].split()[-1])", (v[j].split()[-1])) - # print("v[j].split()[-1]).replace('*', '')",(v[j].split()[-1]).replace('*', '')) if (v[j].split()[-1]).replace('*', '') in check_if_param_is_in_or_out_dict: for ij in inp_out_params_list_updated[CURR_API]: - # print("inp_out_params_list_updated[CURR_API]sdfsadfsda",inp_out_params_list_updated[CURR_API]) - # print("ij # print inside concat", ij) key = list(ij.keys())[0] value = ij[key] @@ -244,22 +166,13 @@ def concat_params(CURR_API, v, check_if_param_is_in_or_out_dict, inp_out_params_ splited_key = curr_ele.split()[0] if splited_key in all_callback_args[IDX_CALLBACK]: FUNC_ARGS += "callback_" + all_callback_args[IDX_CALLBACK] + ', ' - # print("FUNC_ARGS inside callback") - # print(FUNC_ARGS) IDX_CALLBACK = IDX_CALLBACK + 1 # break - # print("FUNC_ARGS at the end") - # print(FUNC_ARGS) - # flag = flag + 1 - # print("final func args") - # print(FUNC_ARGS) else: - # print("Func_args in else",FUNC_ARGS) FUNC_ARGS += "" + (v[j].split()[-1]) + ', ' FUNC_ARGS = FUNC_ARGS.strip() - # print("fuinc args", FUNC_ARGS) FUNC_ARGS = FUNC_ARGS.rstrip(FUNC_ARGS[-1]) if "void" in FUNC_ARGS: return "" @@ -279,10 +192,6 @@ def init_params_in_out_dict(inp_out_params_list_updated): def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, HEADER_FILE_CONTAINED_FOLDER, enum_dict, enum_dict_pre_post, feature_name, callback_duplicate_check): - # PRE_POST_API_LIST = PRE_POST_API_LIST['badge_create'] - ## print("checking") - ## print("enum_dict", enum_dict) - ## print("enum_pre_post", enum_dict_pre_post) IDX_CALLBACK = 0 inp_out_params_list_updated = {} check_if_param_is_in_or_out_dict = {} @@ -328,62 +237,40 @@ def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_ header_files_dict = get_header_files(MODULE_NAME) - ## print("##############") - ## print("header_files_dict",header_files_dict) # for ever file in the dictionary we have to check if all the api names provided by the user exists or not # we will take api names one by one and check in all the files if it exists or not for API_SEARCH in pre_apis: - ## print("API_SEARCH",API_SEARCH) for HEADER_FILE_NAME in header_files_dict: - ## print("HEADER_FILE_NAME",HEADER_FILE_NAME) inp_out_params_list_updated = input_output_params_extract(MODULE_NAME, HEADER_FILE_NAME, API_SEARCH, inp_out_params_list_updated) - # print("inp_out_params_list_updated in pre api",inp_out_params_list_updated) - # print("post_apis",post_apis) + for API_SEARCH in post_apis: - ## print("hi") for HEADER_FILE_NAME in header_files_dict: - ## print("hi1") inp_out_params_list_updated = input_output_params_extract(MODULE_NAME, HEADER_FILE_NAME, API_SEARCH, inp_out_params_list_updated) - # print("inp_out_params_list_updated in post api",inp_out_params_list_updated) - ## print("hi in post") for HEADER_FILE_NAME in header_files_dict: - ## print("hi") - ## print("HEADER_FILE_NAME",HEADER_FILE_NAME) inp_out_params_list_updated = input_output_params_extract(MODULE_NAME, HEADER_FILE_NAME, API_NAME, inp_out_params_list_updated) - # print("inp_out_params_list_updated in header file",inp_out_params_list_updated) for HEADER_FILE_NAME in header_files_dict: api_desc = api_description_extract(MODULE_NAME, HEADER_FILE_NAME, API_NAME) - # print("api_desc",api_desc) if api_desc != "": break - ## print("###### inp_out_params_list_updated") - ## print(inp_out_params_list_updated) - # global callback_duplicate_check TARGET_API_NAME_CB = API_NAME callback_func_combined = "" for cb_name in all_callback_args: for header_file in header_files_dict: - #print("header_files_dict",header_files_dict) - #print(header_file) if cb_name not in callback_duplicate_check: callback_func_combined = callback_func_combined + cb_function_declaration(MODULE_NAME,header_file,cb_name) - #print('cb_function_declaration(MODULE_NAME,header_file,cb_name', cb_function_declaration(MODULE_NAME,header_file,cb_name)) if cb_function_declaration(MODULE_NAME,header_file,cb_name) != '': callback_duplicate_check.append(cb_name) # break else: callback_func_combined = callback_func_combined + '' - # callback_duplicate_check = callback_duplicate_check + all_callback_args - # print("callback_func_combined") API_NAME = API_NAME.strip() - # print("RET_TYPE - ", RET_TYPE, "API_NAME - ", API_NAME) tc_code0 = ( "/**\n" f"* @testcase utc_{API_NAME}_p\n" - "* @since_tizen 8_0\n" + "* @since_tizen 8.0\n" "* @type Positive\n" f"* @description {api_desc}\n" "* @scenario \n" @@ -403,13 +290,11 @@ def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_ tc_code4 = iniatialize_variables(inp_out_params_list_updated, all_comb_args_set, enum_dict, enum_dict_pre_post) - # print("tc_code_4", tc_code4) tc_code6 = callback_func_combined check_if_param_is_in_or_out_dict = init_params_in_out_dict(inp_out_params_list_updated) # function call to iniatialize - # print("inp_out_params_list_updated",inp_out_params_list_updated) list_target_api_in_params(API_NAME, check_if_param_is_in_or_out_dict, inp_out_params_list_updated) if MODULE_NAME == "nsd": @@ -419,8 +304,6 @@ def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_ tc_code1 = (f" ret = {i}({concat_params(i, PRE_POST_API_ARGS_LIST[i], check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n assert_eq(ret, TIZEN_ERROR_NONE);\n\n" if RET_TYPE[i] != 'void' else f" {i}({concat_params(i, PRE_POST_API_ARGS_LIST[i], check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n\n" for i in pre_apis) - - # print("tc_code1",tc_code1) tc_code_feature = "" if RET_TYPE[API_NAME] != 'void': if feature_name != "": @@ -437,7 +320,6 @@ def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_ f" return 0;\n" " }\n\n") - # print("tc_code_feature",tc_code_feature) if RET_TYPE[API_NAME] == 'void': tc_code2 = (f" {API_NAME}({concat_params(API_NAME, TARGET_API_ARGS, check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n\n") @@ -445,23 +327,14 @@ def tc_code_write1(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, PRE_POST_ else: tc_code2 = (f" ret = {API_NAME}({concat_params(API_NAME, TARGET_API_ARGS, check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n assert_eq(ret, TIZEN_ERROR_NONE);\n\n") - # print("tc_code2",tc_code2) tc_code3 = (f" ret = {j}({concat_params(j, PRE_POST_API_ARGS_LIST[j], check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n assert_eq(ret, TIZEN_ERROR_NONE);\n\n" if RET_TYPE[j] != 'void' else f" {j}({concat_params(j, PRE_POST_API_ARGS_LIST[j], check_if_param_is_in_or_out_dict, inp_out_params_list_updated, all_callback_args, IDX_CALLBACK, PRE_POST_API_ARGS_LIST, TARGET_API_ARGS, TARGET_API_NAME_CB)});\n\n" for j in post_apis) - - # print("tc code 3", ''.join(tc_code3)) tc_code5 = (f" return 0;\n" "}\n") - # print("tc code 5", tc_code5) - ## print("tc_code_6", tc_code6) - ## print("checking tccode1") - ## print(''.join(tc_code1)) - ## print("\n" + ''.join(tc_code1)) - ## print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^66") # print("checking tc") # print("\n" + tc_code6 + "\n\n" + tc_code0 + tc_code + tc_code4 + "\n" + ''.join(tc_code1) + tc_code_feature + tc_code2 + ''.join(tc_code3) + tc_code5) return "\n" + tc_code6 + "\n\n" + tc_code0 + tc_code + tc_code4 + "\n" + ''.join(tc_code1) + tc_code_feature + tc_code2 + ''.join(tc_code3) + tc_code5 diff --git a/tool/TC_Assistant_Tool/template_tc_negative.py b/tool/TC_Assistant_Tool/template_tc_negative.py index 236b0fb0a..eecc7d997 100644 --- a/tool/TC_Assistant_Tool/template_tc_negative.py +++ b/tool/TC_Assistant_Tool/template_tc_negative.py @@ -359,7 +359,7 @@ def tc_code_write_negative(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, P tc_code0 = ( "/**\n" f"* @testcase utc_{API_NAME}_n{NEGATIVE_TC_COUNT}\n" - "* @since_tizen 8_0\n" + "* @since_tizen 8.0\n" "* @type Negative\n" f"* @description {api_desc} Invalid parameters passed and check API's return value with error code.\n" "* @scenario \n" @@ -368,7 +368,7 @@ def tc_code_write_negative(RET_TYPE, MODULE_NAME, API_NAME, PRE_POST_API_LIST, P tc_code0 = ( "/**\n" f"* @testcase utc_{API_NAME}_n\n" - "* @since_tizen 8_0\n" + "* @since_tizen 8.0\n" "* @type Negative\n" f"* @description {api_desc} Invalid parameters passed and check API's return value with error code.\n" "* @scenario \n" diff --git a/tool/TC_Assistant_Tool/tool_dataset.csv b/tool/TC_Assistant_Tool/tool_dataset.csv new file mode 100644 index 000000000..49df597df --- /dev/null +++ b/tool/TC_Assistant_Tool/tool_dataset.csv @@ -0,0 +1,154 @@ +,Text,label +0,add utc for webrtc apis,existingmodule +1,The module is already existing,existingmodule +2,REQUEST TO CREATE UTC OF NEW MODULE,newmodule +3,tizen version 6.5,tizenversion +4,Request is for Tizen version 6.0,tizenversion +5,REQUEST TO COVER NEW APIS,request +6,MODULE NAME: BLUETOOTH,modulename +7,MODULE NAME:,modulename +8,request to prepare utc,request +9,file name: utc_media_webrtc.c,tcwritelocation +10,THIS IS REQUEST TO COVER NEW MODULE APIS,newmodule +11,FILE NAME: UTC_MEDIA_WEBRTC.C,tcwritelocation +12,POST:,prepostinfo +13,HI,greetings +14,Add utc for webrtc APIs,existingmodule +15,file name:,tcwritelocation +16,pre: attach_panel_create,prepostinfo +17,"its existing module, need to add new tcs",existingmodule +18,"Its existing module, need to add new TCs",existingmodule +19,TIZEN VERSION 6.5,tizenversion +20,hello,greetings +21,Tizen 6.5,tizenversion +22,Tizen 7.0,tizenversion +23,Pre: attach_panel_show Post: attach_panel_destroy,prepostinfo +24,Request to create UTC of new module,newmodule +25,"ITS EXISTING MODULE, NEED TO ADD NEW TCS",existingmodule +26,Tizen version 6.5,tizenversion +27,the module is already existing,existingmodule +28,Request is for Tizen version 7.0,tizenversion +29,FILE NAME:,tcwritelocation +30,request is for tizen version 6.0,tizenversion +31,Tizen version 7.0,tizenversion +32,PRE:,prepostinfo +33,REQUEST IS FOR TIZEN VERSION 7.0,tizenversion +34,API names: attach_panel_create attach_panel_destroy,apiinfo +35,Tizen 6.0,tizenversion +36,module name:,modulename +37,request is for tizen version 6.5,tizenversion +38,tizen version 6.0,tizenversion +39,Post:,prepostinfo +40,tizen 6.0,tizenversion +41,module name: bluetooth,modulename +42,api names:,apiinfo +43,NEED TO ADD NEW APIS IN BLUETOOTH MODULE,existingmodule +44,API names:,apiinfo +45,Module name: bluetooth,modulename +46,Module name:,modulename +47,This is an ACR request,request +48,This is request to cover new module APIs,newmodule +49,file name: utc-messaging-email.c,tcwritelocation +50,REQUEST TO PREPARE UTC,request +51,pre: attach_panel_show post: attach_panel_destroy,prepostinfo +52,TIZEN 7.0,tizenversion +53,Tizen version 6.0,tizenversion +54,HELLO,greetings +55,tizen 7.0,tizenversion +56,TIZEN VERSION 7.0,tizenversion +57,THIS IS AN ACR REQUEST,request +58,FILE name: utc-messaging-email.c,tcwritelocation +59,post: attach_panel_destroy,prepostinfo +60,Pre: attach_panel_create,prepostinfo +61,PRE: ATTACH_PANEL_SHOW POST: ATTACH_PANEL_DESTROY,prepostinfo +62,REQUEST IS FOR TIZEN VERSION 6.5,tizenversion +63,API NAMES:,apiinfo +64,REQUEST IS FOR TIZEN VERSION 6.0,tizenversion +65,Request is for Tizen version 6.5,tizenversion +66,request to cover new apis,request +67,TIZEN 6.0,tizenversion +68,FILE name:,tcwritelocation +69,TIZEN 6.5,tizenversion +70,API NAMES: ATTACH_PANEL_CREATE ATTACH_PANEL_DESTROY,apiinfo +71,POST: ATTACH_PANEL_DESTROY,prepostinfo +72,tizen version 7.0,tizenversion +73,Request to cover new APIS,request +74,hi,greetings +75,hello,greetings +76,THE MODULE IS ALREADY EXISTING,existingmodule +77,request is for tizen version 7.0,tizenversion +78,Need to add new APIs in bluetooth module,existingmodule +79,post:,prepostinfo +80,FILE name: utc_media_webrtc.c,tcwritelocation +81,Request to prepare UTC,request +82,FILE NAME: UTC-MESSAGING-EMAIL.C,tcwritelocation +83,request to create utc of new module,newmodule +84,ARCH: PROFILE: ,executetc +85,need to add new apis in bluetooth module,existingmodule +86,this is request to cover new module apis,newmodule +87,Pre:,prepostinfo +88,hi,greetings +89,Post: attach_panel_destroy,prepostinfo +90,PRE: ATTACH_PANEL_CREATE,prepostinfo +91,ARCH: armv7l PROFILE: wearable,executetc +92,this is an acr request,request +93,pre:,prepostinfo +94,ARCH: armv7l PROFILE: tizeniot,executetc +95,TIZEN VERSION 6.0,tizenversion +96,ARCH: armv7l PROFILE: mobile,executetc +97,ADD UTC FOR WEBRTC APIS,existingmodule +98,api names: attach_panel_create attach_panel_destroy,apiinfo +99,ARCH: armv7l PROFILE: tv,executetc +100,tizen 6.5,tizenversion +101,header info:,headerinfo +102,Do you want to add negative TCs?,negativetc +103,Add a negative TC,negativetc +104,negative TC,negativetc +105,Header File:dns-sd.h,headerinfo +106,Back,goback +107,I want to go back,goback +108,Feature name:,featureinfo +109,feature:,featureinfo +110,New module:,newmodule +111,newmodule:,newmodule +112,Header File:,headerinfo +113,headerfile:,headerinfo +114,existing,existingmodule +115,I want to add negative tc,negativetc +116,NEW MODULE:webrtc,newmodule +117,pre:yaca_key_generate,prepostinfo +118,pre:yaca,prepostinfo +119,Pre:yaca,prepostinfo +120,PRE:yaca,prepostinfo +121,Module name:yaca,modulename +122,Support,supportsys +123,I want support for issue,supportsys +124,Environment Setup,envsetupsupport +125,Need help for environment setup,envsetupsupport +126,Installing rootstrap,rootstrapsupport +127,Need help for installing rootstrap,rootstrapsupport +128,Build Issue,buildsupport +129,I want support for build related issue,buildsupport +130,Logs:,buildlogdebug +131,log:,buildlogdebug +132,Install issue,installsupport +133,I want help regarding install issue,installsupport +134,Need support,supportsys +135,Support Assistant,supportsys +136,i need to add a new module,newmodule +137,dictionary:,prepostinfo +138,dictionary: post:,prepostinfo +139,remove deprecated api,removeapi +140,remove apis,removeapi +141,REMOVE APIS,removeapi +142,REMOVE DEPRECATED API,removeapi +143,deprecated apis,removeapi +144,DEPRECATED APIS,removeapi +145,"DELETE: API_NAME_1, API_NAME_2",inputremovalapi +146,DELETE:,inputremovalapi +147,delete:,inputremovalapi +148,"delete: api_name_1, api_name_2",inputremovalapi +149,"EXCLUDE: 1, 2, 3",donotremove +150,"exclude: 1, 2, 3",donotremove +151,EXCLUDE:,donotremove +152,exclude:,donotremove diff --git a/tool/TC_Assistant_Tool/trainedmodel.py b/tool/TC_Assistant_Tool/trainedmodel.py index 838eeffc1..fd2bcb8ce 100755 --- a/tool/TC_Assistant_Tool/trainedmodel.py +++ b/tool/TC_Assistant_Tool/trainedmodel.py @@ -47,7 +47,7 @@ logger = logger_init() # We have prepared a dataset with 7 labels try: - df = pd.read_csv('newdata.csv', encoding='ISO-8859-1') + df = pd.read_csv('tool_dataset.csv', encoding='ISO-8859-1') df.head() except: log_create(logger, "Error occurred while reading dataset file!") @@ -111,7 +111,7 @@ try: self.relu = nn.ReLU() self.fc1 = nn.Linear(768, 512) self.fc2 = nn.Linear(512, 256) - self.fc3 = nn.Linear(256, 21) + self.fc3 = nn.Linear(256, 24) self.softmax = nn.LogSoftmax(dim=1) def forward(self, sent_id, mask):