Skip to content

add deployment function #3618

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

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open

Conversation

chuynh4duarte
Copy link
Collaborator

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

A description of the changes contained in the PR.

Rationale

A rationale for this change. e.g. fixes bug, or most projects need XYZ feature.

Testing/Review Recommendations

Fill in testing procedures, specific items to focus on for review, or other info to help the team verify these changes are flight-quality.

Future Work

Note any additional work that will be done relating to this issue.


def regenerate_file(seqfile1,deployment):
# ex: test_seq.seq
oldfile1 = open (seqfile1 +".seq", "r")

Check warning

Code scanning / CodeQL

File is not always closed Warning test

File may not be closed if an exception is raised.
def regenerate_file(seqfile1,deployment):
# ex: test_seq.seq
oldfile1 = open (seqfile1 +".seq", "r")
newfile1 = open (seqfile1 +"_new.seq", "w")

Check warning

Code scanning / CodeQL

File is not always closed Warning test

File may not be closed if an exception is raised.
Copy link
Collaborator

@kevin-f-ortega kevin-f-ortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuynh4duarte, looks good to me. I added some comments for you to address. Thank you


# 1st remove file PrmDB.dat (manually)
# setup directory to remove later
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.FileManager') + '.' + 'CreateDirectory', ["/tmp/PrmDb"], max_delay=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to get prmdb filename from fprime_test_api

# send PRM_SAVE_FILE (Wrote 0 records)
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.PrmDb') + '.' + 'PRM_SAVE_FILE', max_delay=1)
# Verify PrmDB.dat is empty open /tmp/save_file1 (PrmDb.dat file = 0bytes )
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.FileManager') + '.' + 'ShellCommand', ["ls -lagt", "/tmp/PrmDb/save_file1"], max_delay=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


Tests command send, dispatch, and receipt using send_and_assert command with a pair of version commands.
"""
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.Version') + '.' + 'VERSION',["PROJECT"], max_delay=1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I would like to add a check that the event reports the expected fsw version and that the telemetry channel matches too.

Same for the other commands like FRAMEWORK, LIBRARY, CUSTOM, ALL

# make sure file save
time.sleep(2)
# Verify PrmDb.dat is increase = 13 bytes open /tmp/save_file2 (PrmDb.dat file = 13bytes )
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.FileManager') + '.' + 'ShellCommand', ["ls -lagt", "/tmp/PrmDb/save_file2"], max_delay=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not use ShellCommand this would not work for VxWorks. The script should send a FileDownlink request for the file, once the file is downloaded to the GDS machine, then you can use linux commands in python to get the size.



## setup default-value
fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Ref.RecvBuff') + '.' + 'PARAMETER1_PRM_SET', [5], max_delay=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component InT tests should not use Ref-specific components like Ref.RecvBuff. Unfortunately, there isn't a deployment-agnostic way to fully test PrmDb. I think this whole test should be moved to the Ref/test/int script.

This test script would only test a nominal PRM_SAVE_FILE, which will unfortunately write 0 records.

deployment = fprime_test_api.get_deployment()

## source = /tmp/file/shell_ls2.log , Dest = /tmp/chuynh/fprime-downlink/DL.log
fprime_test_api.send_and_assert_command(deployment + "." + "fileDownlink.SendFile", ["/tmp/file/shell_ls2.log", "DL.log"], max_delay=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to use the fprime_test_api

CS_JOINT_WAIT (Need to have more 1 run sequence. Ref don't have more one sequence)
"""

fprime_test_api.send_and_assert_command(fprime_test_api.getCmdDispName('Svc.CmdSequencer') + '.' + 'CS_VALIDATE',["/tmp/ref_test_seq.bin"], max_delay=1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test looks good. But should not use hardcoded files. Topic to discuss with LeStarch

# sequence = Path(__file__).parent / "test_seq_new.seq"
# sequence2 = Path(__file__).parent / "test_seq_wait_new.seq"

sequence = Path(__file__).parent / regenerate_file("test_seq",deployment)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to regenerate the sequence file? I think we can just use the original seq file.

== 0
), "Failed to run fprime-seqgen"

fprime_test_api.send_and_assert_command(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for ref_test_seq_wait.bin ?


## regenerate .seq file

def regenerate_file(seqfile1,deployment):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this function?

@kevin-f-ortega
Copy link
Collaborator

@chuynh4duarte, could you also add the Ref config json file to the Ref/test/int directory?

newfile1.close()
return seqfile1 +"_new.seq"

def test_seqgen(fprime_test_api):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to:

  1. Write out a sequence file. e.g.,
Instead of reading the original sequence file, just create the new seq file using this string. This avoids needing to parse the original sequence file
"""
00:00:00 {}.CMD_NO_OP
00:00:01 {}.CMD_NO_OP_STRING HELLO
""".format(cmdDisplay)

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.

2 participants