Skip to content

Commit

Permalink
Modify COSMOS install script to also copy test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco committed Sep 6, 2024
1 parent 2b86ad4 commit 5c9b2be
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
7 changes: 7 additions & 0 deletions gnd/cosmos/install_cosmos_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ adamant_assembly_name=${adamant_assembly_model%.assembly.yaml}
adamant_assembly_name=${adamant_assembly_name##*/}
adamant_assembly_dir=`dirname $adamant_assembly_model`
cosmos_plugin_dir=`realpath $cosmos_plugin_dir`
adamant_script_dir=`realpath $adamant_assembly_dir/../../../test/scripts`
cosmos_script_dir=`realpath $cosmos_plugin_dir/../plugins/DEFAULT/targets_modified`

# Get build directory:
adamant_assembly_name_short=(${adamant_assembly_name//_/ })
Expand Down Expand Up @@ -53,5 +55,10 @@ do_copy() {
do_copy "$adamant_assembly_cmdtlm_dir/${adamant_assembly_name}_ccsds_cosmos_commands.txt" $cosmos_plugin_dir/targets/$adamant_assembly_name_upper/cmd_tlm/cmd.txt
do_copy "$adamant_assembly_cmdtlm_dir/${adamant_assembly_name}_ccsds_cosmos_telemetry.txt" $cosmos_plugin_dir/targets/$adamant_assembly_name_upper/cmd_tlm/tlm.txt
do_copy "$adamant_assembly_plugin_dir/plugin.txt" $cosmos_plugin_dir/plugin.txt
do_copy "$adamant_script_dir/update-param-sys.py" $cosmos_script_dir/update-param-sys.py
do_copy "$adamant_script_dir/validate-param-sys.py" $cosmos_script_dir/validate-param-sys.py
do_copy "$adamant_script_dir/test_setup.py" $cosmos_script_dir/test_setup.py
do_copy "$adamant_script_dir/crc_16.py" $cosmos_script_dir/crc_16.py
echo "Success."
echo "Plugin files copied to $cosmos_plugin_dir."
echo "Script files copied to $cosmos_script_dir."
17 changes: 14 additions & 3 deletions test/scripts/update-param-sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@
Test_Packed_Table += bytearray(struct.pack(">f", -5.00))
# Osc_B_Off
Test_Packed_Table += bytearray(struct.pack(">f", -2.50))
table_length = len(Test_Packed_Table)
# Version
#Test_Packed_Table += bytearray(struct.pack(">f", 0.0))
# Crc_Table
#Test_Packed_Table += bytearray(struct.pack(">h", 0))
# Buffer_Length
#Test_Packed_Table += bytearray(struct.pack(">h", 0))

#test_crc = crc_16.crc_16(Test_Packed_Table)
#int_crc = int.from_bytes(test_crc, 'big')
#print(int_crc) # Remove if CRC fully functional

# Send nominal Update_Parameter_Table command expecting success:
cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table),
"Header.Table_Buffer_Length": table_length,
"Header.Crc_Table": 19692,
"Table_Buffer": list(Test_Packed_Table)
})
Expand All @@ -40,7 +51,7 @@
# Send test Update_Parameter_Table command with bad CRC expecting Memory_Region_Crc_Invalid, Parameter_Table_Copy_Failure,
# Working_Table_Update_Failure, and Command_Execution_Failure:
cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table),
"Header.Table_Buffer_Length": table_length,
"Header.Crc_Table": 0,
"Table_Buffer": list(Test_Packed_Table)
})
Expand All @@ -54,7 +65,7 @@
# Send test Update_Parameter_Table command with bad length expecting Memory_Region_Length_Mismatch, Parameter_Table_Copy_Failure,
# Working_Table_Update_Failure, and Command_Execution_Failure:
cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table) + 1,
"Header.Table_Buffer_Length": table_length + 1,
"Header.Crc_Table": 19692,
"Table_Buffer": list(Test_Packed_Table)
})
Expand Down
20 changes: 16 additions & 4 deletions test/scripts/validate-param-sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@
Test_Packed_Table += bytearray(struct.pack(">f", -5.00))
# Osc_B_Off
Test_Packed_Table += bytearray(struct.pack(">f", -2.50))
table_length = len(Test_Packed_Table)
# Version
#Test_Packed_Table += bytearray(struct.pack(">f", 0.0))
# Crc_Table
#Test_Packed_Table += bytearray(struct.pack(">h", 0))
# Buffer_Length
#Test_Packed_Table += bytearray(struct.pack(">h", 0))

#test_crc = crc_16.crc_16(Test_Packed_Table)
#int_crc = int.from_bytes(test_crc, 'big')
#print(int_crc) # Remove if CRC fully functional

# Send nominal Validate_Parameter_Table command expecting success:
cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table),
"Header.Table_Buffer_Length": table_length,
"Header.Crc_Table": 19692,
"Table_Buffer": list(Test_Packed_Table)
})
Expand All @@ -40,7 +51,7 @@
# Send test Validate_Parameter_Table command with bad CRC expecting Memory_Region_Crc_Invalid, Table_Validation_Failure, and
# Command_Execution_Failure:
cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table),
"Header.Table_Buffer_Length": table_length,
"Header.Crc_Table": 0,
"Table_Buffer": list(Test_Packed_Table)
})
Expand All @@ -54,7 +65,7 @@
# Send test Validate_Parameter_Table command with bad length expecting Memory_Region_Length_Mismatch, Table_Validation_Failure, and
# Command_Execution_Failure:
cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table) + 1,
"Header.Table_Buffer_Length": table_length + 1,
"Header.Crc_Table": 19692,
"Table_Buffer": list(Test_Packed_Table)
})
Expand All @@ -80,6 +91,7 @@
Test_Packed_Table += bytearray(struct.pack(">f", -5.00))
# Osc_B_Off
Test_Packed_Table += bytearray(struct.pack(">f", -2.50))
table_length = len(Test_Packed_Table)
# Version
#Test_Packed_Table += bytearray(struct.pack(">f", 0.0))
# Crc_Table
Expand All @@ -88,7 +100,7 @@
#Test_Packed_Table += bytearray(struct.pack(">h", 55))

cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", {
"Header.Table_Buffer_Length": len(Test_Packed_Table),
"Header.Table_Buffer_Length": table_length,
"Header.Crc_Table": 65043,
"Table_Buffer": list(Test_Packed_Table)
})
Expand Down

0 comments on commit 5c9b2be

Please sign in to comment.