Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #131 - updated CHeaderParser.py to address specific issues #132

Merged

Conversation

lbleier-GSFC
Copy link
Contributor

Describe the contribution
Fixes #131 addressing issues raised by end user

Testing performed
No sample input available so no testing performed; will need to be tested

Expected behavior changes
Fix the issues raised in #131

Contributor Info - All information REQUIRED for consideration of pull request
Leor Bleier GSFC\Code 582

@yammajamma yammajamma added CCB:Approved Indicates approval by CCB IC-20200902 labels Sep 2, 2020
@yammajamma yammajamma marked this pull request as draft September 2, 2020 19:59
@yammajamma
Copy link
Contributor

Convert to draft based on CCB-20200902 comments.

@stanislaw
Copy link

stanislaw commented Sep 3, 2020

@lbleier-GSFC, it seems to work better now: I add the argument to the SAMPLE_APP_CMD_NOP_CC command and it is displayed correctly in the UI.

However, notice two details below:

  1. 0 of 0!
Showing structure 0 of 0 below
  1. SAMPLE_APP_CMD_NOP2_CC instead of SAMPLE_APP_CMD_NOP_CC
The following commands have been added with parameters:
['SAMPLE_APP_CMD_NOP2_CC']

P.S. To be honest, I don't believe you can fix this once and forever until functional tests are introduced. A python test program could be written and it could exercise all of the user inputs automatically and check the inputs (sending stdin and grepping over stdout).


Full input:

$ python CHeaderParser.py
Using header files found in CHeaderParser-hdr-paths.txt
We need to save the command into to a pickle file in 'CommandFile/'.
Please do not use any spaces/quotes in your filename. Ex: my_app_cmd_file
What would you like the command file to be saved as? Sample

Unused Commands
-----------------------------------------
(Command 1 of 2) SAMPLE_APP_CMD_NOP_CC
(Command 2 of 2) SAMPLE_APP_CMD_NOP2_CC
Do any commands in Sample require parameters? (yes/no): yes
Enter a value from the list above or -1 to exit: 1
This program will now attempt to find the command structure for SAMPLE_APP_CMD_NOP_CC

Showing structure 0 of 0 below
--------------------------------------------
struct Foo {
uint32 arg1;
};
--------------------------------------------
Enter a value from the list above or -1 to exit: 0



Line (0) -> struct Foo {
Line (1) -> uint32 arg1;
Line (2) -> };
Enter the line of the parameter from the above print-out (-1 to stop): 1
dataTypeOrig: uint32
dataTypeNew: --word
paramName: arg1
paramLen:
stringLen:
Added: arg1 with type --word



Line (0) -> struct Foo {
Line (1) -> };
Enter the line of the parameter from the above print-out (-1 to stop): -1
You have chosen to stop adding parameters.

Unused Commands
-----------------------------------------
Command (1 of 1) SAMPLE_APP_CMD_NOP_CC
Enter a value from the list above or -1 to exit: -1
Exiting.
Thank you for using CHeaderParser.
The following commands have been added with parameters:
['SAMPLE_APP_CMD_NOP2_CC']

@stanislaw
Copy link

This is what happens if I select the second command:

python CHeaderParser.py
Using header files found in CHeaderParser-hdr-paths.txt
We need to save the command into to a pickle file in 'CommandFile/'.
Please do not use any spaces/quotes in your filename. Ex: my_app_cmd_file
What would you like the command file to be saved as? SAMPLE_APP_CMD

Unused Commands
-----------------------------------------
(Command 1 of 2) SAMPLE_APP_CMD_NOP_CC
(Command 2 of 2) SAMPLE_APP_CMD_NOP2_CC
Do any commands in SAMPLE_APP_CMD require parameters? (yes/no): yes
Enter a value from the list above or -1 to exit: 2
This program will now attempt to find the command structure for SAMPLE_APP_CMD_NOP2_CC

Showing structure 0 of 0 below
--------------------------------------------
struct Foo {
uint32 arg1;
};
--------------------------------------------
Enter a value from the list above or -1 to exit: 0



Line (0) -> struct Foo {
Line (1) -> uint32 arg1;
Line (2) -> };
Enter the line of the parameter from the above print-out (-1 to stop): 1
dataTypeOrig: uint32
dataTypeNew: --word
paramName: arg1
paramLen:
stringLen:
Added: arg1 with type --word



Line (0) -> struct Foo {
Line (1) -> };
Enter the line of the parameter from the above print-out (-1 to stop): -1
You have chosen to stop adding parameters.
Traceback (most recent call last):
  File "CHeaderParser.py", line 491, in <module>
    used_cmdDesc.append(unused_cmdDesc[command_choice])
IndexError: list index out of range

@lbleier-GSFC
Copy link
Contributor Author

@lbleier-GSFC, it seems to work better now: I add the argument to the SAMPLE_APP_CMD_NOP_CC command and it is displayed correctly in the UI.

However, notice two details below:

  1. 0 of 0!
Showing structure 0 of 0 below
  1. SAMPLE_APP_CMD_NOP2_CC instead of SAMPLE_APP_CMD_NOP_CC
The following commands have been added with parameters:
['SAMPLE_APP_CMD_NOP2_CC']

P.S. To be honest, I don't believe you can fix this once and forever until functional tests are introduced. A python test program could be written and it could exercise all of the user inputs automatically and check the inputs (sending stdin and grepping over stdout).

Full input:

$ python CHeaderParser.py
Using header files found in CHeaderParser-hdr-paths.txt
We need to save the command into to a pickle file in 'CommandFile/'.
Please do not use any spaces/quotes in your filename. Ex: my_app_cmd_file
What would you like the command file to be saved as? Sample

Unused Commands
-----------------------------------------
(Command 1 of 2) SAMPLE_APP_CMD_NOP_CC
(Command 2 of 2) SAMPLE_APP_CMD_NOP2_CC
Do any commands in Sample require parameters? (yes/no): yes
Enter a value from the list above or -1 to exit: 1
This program will now attempt to find the command structure for SAMPLE_APP_CMD_NOP_CC

Showing structure 0 of 0 below
--------------------------------------------
struct Foo {
uint32 arg1;
};
--------------------------------------------
Enter a value from the list above or -1 to exit: 0



Line (0) -> struct Foo {
Line (1) -> uint32 arg1;
Line (2) -> };
Enter the line of the parameter from the above print-out (-1 to stop): 1
dataTypeOrig: uint32
dataTypeNew: --word
paramName: arg1
paramLen:
stringLen:
Added: arg1 with type --word



Line (0) -> struct Foo {
Line (1) -> };
Enter the line of the parameter from the above print-out (-1 to stop): -1
You have chosen to stop adding parameters.

Unused Commands
-----------------------------------------
Command (1 of 1) SAMPLE_APP_CMD_NOP_CC
Enter a value from the list above or -1 to exit: -1
Exiting.
Thank you for using CHeaderParser.
The following commands have been added with parameters:
['SAMPLE_APP_CMD_NOP2_CC']

@stanislaw I agree this needs to be thoroughly tested. I am implementing fixes for the above issues at least for you to try

@lbleier-GSFC
Copy link
Contributor Author

Adding @skliper to follow this

@stanislaw
Copy link

Sorry for the delay with the feedback. I hope to get to testing this tomorrow.

@yammajamma yammajamma removed CCB:Approved Indicates approval by CCB IC-20200902 labels Sep 8, 2020
@stanislaw
Copy link

I am testing this again. Both issues reported in my latest comment seem to have been fixed with the latest commit b44dc44.

I have also noticed this other group of (hopefully) more trivial issues: the tool always raises exceptions when the Enter key is pressed instead of a number here:

Enter the line of the parameter from the above print-out (-1 to stop):
Traceback (most recent call last):
  File "CHeaderParser.py", line 384, in <module>
    param_line = int(
ValueError: invalid literal for int() with base 10: ''

and here:

Enter a value from the list above or -1 to exit:
Traceback (most recent call last):
  File "CHeaderParser.py", line 249, in <module>
    if command_choice == -1:
NameError: name 'command_choice' is not defined

Thank you.

@lbleier-GSFC
Copy link
Contributor Author

lbleier-GSFC commented Sep 8, 2020

I am testing this again. Both issues reported in my latest comment seem to have been fixed with the latest commit b44dc44.

I have also noticed this other group of (hopefully) more trivial issues: the tool always raises exceptions when the Enter key is pressed instead of a number here:

Enter the line of the parameter from the above print-out (-1 to stop):
Traceback (most recent call last):
  File "CHeaderParser.py", line 384, in <module>
    param_line = int(
ValueError: invalid literal for int() with base 10: ''

and here:

Enter a value from the list above or -1 to exit:
Traceback (most recent call last):
  File "CHeaderParser.py", line 249, in <module>
    if command_choice == -1:
NameError: name 'command_choice' is not defined

Thank you.

OK, should be fixed. Look at this personal service you're getting 🙂

@skliper skliper marked this pull request as ready for review September 9, 2020 13:40
@skliper skliper added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Sep 9, 2020
@astrogeco
Copy link
Contributor

CCB 2020-09-09 APPROVED

@yammajamma yammajamma added IC-20200909 and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Sep 10, 2020
@yammajamma yammajamma merged commit e293b90 into nasa:integration-candidate Sep 10, 2020
jphickey pushed a commit that referenced this pull request Sep 10, 2020
* Fix #131 - updated CHeaderParser.py to address specific issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants