diff --git a/cmp_tool.c b/cmp_tool.c index fd8401f96975fd06a4c82b7a0216758ab33aae2a..90aa1df4ab1211682691b5c121ad9907f2232c50 100755 --- a/cmp_tool.c +++ b/cmp_tool.c @@ -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) { diff --git a/include/cmp_io.h b/include/cmp_io.h index 77dce35b4f571b485267a8fae2ed74b726c38f2b..179d59f04d910b89d34f53ffbd0f85c321a5412b 100644 --- a/include/cmp_io.h +++ b/include/cmp_io.h @@ -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" diff --git a/include/meson.build b/include/meson.build index d5946c80cc53479b6150506399f6bdda7684a5b4..491eef5ecebc527e3df0fb677d7e81907bcb9895 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1,7 +1,7 @@ # 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 diff --git a/lib/cmp_io.c b/lib/cmp_io.c index 9f7fd7294ee4884cc7624deea3588b6cad403dbb..9dc9ba1f0c64d9e0cfc0d22ddca2db774945258b 100644 --- a/lib/cmp_io.c +++ b/lib/cmp_io.c @@ -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" /** diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py old mode 100644 new mode 100755 index f5a022b3538c3e280383eb2af22368bc3201a701..72d32c47ab34f866af6e12b4c54e1867772dc86a --- a/test/cmp_tool/cmp_tool_integration_test.py +++ b/test/cmp_tool/cmp_tool_integration_test.py @@ -1,3 +1,5 @@ +#!/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) +