Skip to content
Snippets Groups Projects
Commit 07a0445d authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

adapt code to cmp_tool-config.h file

parent a8d53959
Branches
Tags
1 merge request!11decompression/compression for non-imagette data
......@@ -25,16 +25,15 @@
#include <getopt.h>
#include <time.h>
#include "include/cmp_io.h"
#include "include/cmp_icu.h"
#include "include/decmp.h"
#include "include/cmp_guess.h"
#include "include/cmp_entity.h"
#include "include/rdcu_pkt_to_file.h"
#include "cmp_tool-config.h"
#include "cmp_io.h"
#include "cmp_icu.h"
#include "decmp.h"
#include "cmp_guess.h"
#include "cmp_entity.h"
#include "rdcu_pkt_to_file.h"
#define VERSION "0.08"
#define BUFFER_LENGTH_DEF_FAKTOR 2
......@@ -190,7 +189,7 @@ int main(int argc, char **argv)
verbose_en = 1;
break;
case 'V': /* --version */
printf("%s version %s\n", PROGRAM_NAME, VERSION);
printf("%s version %s\n", PROGRAM_NAME, CMP_TOOL_VERSION);
exit(EXIT_SUCCESS);
break;
case DIFF_CFG_OPTION:
......@@ -273,9 +272,9 @@ int main(int argc, char **argv)
printf("#########################################################\n");
printf("### PLATO Compression/Decompression Tool Version %s ###\n",
VERSION);
CMP_TOOL_VERSION);
printf("#########################################################\n");
if (!strcmp(VERSION, "0.07") || !strcmp(VERSION, "0.08"))
if (!strcmp(CMP_TOOL_VERSION, "0.07") || !strcmp(CMP_TOOL_VERSION, "0.08"))
printf("Info: Note that the behaviour of the cmp_tool has changed. From now on, the compressed data will be preceded by a header by default. The old behaviour can be achieved with the --no_header option.\n\n");
if (!data_file_name) {
......@@ -629,7 +628,7 @@ static int add_cmp_ent_hdr(struct cmp_cfg *cfg, struct cmp_info *info,
cmp_bit_to_4byte(info->cmp_size));
ent = (struct cmp_entity *)cfg->icu_output_buf;
s = cmp_ent_build(ent, data_type, cmp_tool_gen_version_id(VERSION),
s = cmp_ent_build(ent, data_type, cmp_tool_gen_version_id(CMP_TOOL_VERSION),
start_time, cmp_ent_create_timestamp(NULL), model_id,
model_counter, info, cfg);
if (!s) {
......
......@@ -20,7 +20,6 @@
#include "cmp_support.h"
#include "cmp_entity.h"
#define PROGRAM_NAME "cmp_tool"
#define MAX_CONFIG_LINE 256
#define DEFAULT_OUTPUT_PREFIX "OUTPUT"
......
# generate the configuration file
cdata = configuration_data()
cdata.set_quoted('PROGRAM_NAME', 'cmp_tool')
cdata.set_quoted('VERSION_STR', meson.project_version())
cdata.set_quoted('CMP_TOOL_VERSION', meson.project_version())
if get_option('argument_input_mode')
cdata.set('ARGUMENT_INPUT_MODE', '')
endif
......
......@@ -24,10 +24,11 @@
#include <ctype.h>
#include <sys/stat.h>
#include "../include/cmp_io.h"
#include "../include/cmp_support.h"
#include "../include/rdcu_cmd.h"
#include "../include/byteorder.h"
#include "cmp_tool-config.h"
#include "cmp_io.h"
#include "cmp_support.h"
#include "rdcu_cmd.h"
#include "byteorder.h"
/**
......
#!/usr/bin/env python3
import pytest
import subprocess
import shlex
import sys
......@@ -213,10 +215,7 @@ CMP_START_STR = \
"""#########################################################
### PLATO Compression/Decompression Tool Version %s ###
#########################################################
Info: Note that the behaviour of the cmp_tool has changed. From now on, the compressed data will be preceded by a header by default. The old behaviour can be achieved with the --no_header option.
""" % (VERSION)
print(CMP_START_STR)
CMP_START_STR_CMP = CMP_START_STR + "## Starting the compression ##\n"
CMP_START_STR_DECMP = CMP_START_STR + "## Starting the decompression ##\n"
......@@ -277,8 +276,8 @@ def test_print_diff_cfg():
args = ['--diff_cfg', '--diff_cfg -a', '--diff_cfg --rdcu_par']
for i, arg in enumerate(args):
returncode, stdout, stderr = call_cmp_tool(arg)
assert(returncode == EXIT_SUCCESS)
assert(stderr == "")
assert(returncode == EXIT_SUCCESS)
cfg = parse_key_value(stdout)
assert(cfg['cmp_mode'] == '2')
......@@ -368,8 +367,8 @@ def test_compression_diff():
# generate test configuration
with open(cfg_file_name, 'w', encoding='utf-8') as f:
returncode, stdout, stderr = call_cmp_tool("--diff_cfg")
assert(returncode == EXIT_SUCCESS)
assert(stderr == "")
assert(returncode == EXIT_SUCCESS)
f.write(stdout)
add_args = [" --no_header", ""]
......@@ -379,8 +378,8 @@ def test_compression_diff():
" -c "+cfg_file_name+" -d "+data_file_name + " -o "+output_prefix+add_arg)
# check compression results
assert(returncode == EXIT_SUCCESS)
assert(stderr == "")
assert(returncode == EXIT_SUCCESS)
assert(stdout == CMP_START_STR_CMP +
"Importing configuration file %s ... DONE\n" % (cfg_file_name) +
"Importing data file %s ... \n" % (data_file_name) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment