瀏覽代碼

remove old dumped message unit tests

Julius Pfrommer 7 年之前
父節點
當前提交
8b3f7c1f03
共有 3 個文件被更改,包括 2 次插入114 次删除
  1. 2 3
      tests/CMakeLists.txt
  2. 0 81
      tests/server/check_server_binary_messages.c
  3. 0 30
      tools/hex2bin.py

+ 2 - 3
tests/CMakeLists.txt

@@ -107,7 +107,7 @@ add_test_valgrind(utils ${TESTS_BINARY_DIR}/check_utils)
 
 add_executable(check_securechannel check_securechannel.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
 target_link_libraries(check_securechannel ${LIBS})
-add_test_valgrind(check_securechannel ${TESTS_BINARY_DIR}/check_securechannel)
+add_test_valgrind(securechannel ${TESTS_BINARY_DIR}/check_securechannel)
 
 # Test Server
 
@@ -157,10 +157,9 @@ if(UA_ENABLE_DISCOVERY)
     add_test_valgrind(discovery ${TESTS_BINARY_DIR}/check_discovery)
 endif()
 
-# Readspeed server
 add_executable(check_server_readspeed server/check_server_readspeed.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
 target_link_libraries(check_server_readspeed ${LIBS})
-add_test_valgrind(check_server_readspeed ${TESTS_BINARY_DIR}/check_server_readspeed)
+add_test_valgrind(server_readspeed ${TESTS_BINARY_DIR}/check_server_readspeed)
 
 # Test Client
 

+ 0 - 81
tests/server/check_server_binary_messages.c

@@ -1,81 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "check.h"
-
-#include "ua_server.h"
-#include "ua_server_internal.h"
-#include "ua_config_default.h"
-#include "ua_log_stdout.h"
-#include "testing_networklayers.h"
-
-size_t files;
-char **filenames;
-UA_ByteString sentData;
-
-static UA_ByteString readFile(char *filename) {
-    UA_ByteString buf = UA_BYTESTRING_NULL;
-    size_t length;
-    FILE *f = NULL;
-#ifdef WIN32
-    fopen_s(&f, filename,"r");
-#else
-    f = fopen(filename,"r");
-#endif
-
-    if(f) {
-        fseek(f, 0, SEEK_END);
-        length = ftell(f);
-        rewind(f);
-        buf.data = (UA_Byte*)UA_malloc(length);
-        fread(buf.data, sizeof(char), length, f);
-        buf.length = length;
-        fclose(f);
-    }
-
-    return buf;
-}
-
-START_TEST(processMessage) {
-    UA_Connection c = createDummyConnection(&sentData);
-    UA_ServerConfig *config = UA_ServerConfig_new_default();
-    UA_Server *server = UA_Server_new(config);
-    for(size_t i = 0; i < files; i++) {
-        UA_ByteString msg = readFile(filenames[i]);
-        UA_Server_processBinaryMessage(server, &c, &msg);
-        UA_ByteString_deleteMembers(&msg);
-    }
-    UA_Server_run_shutdown(server);
-    UA_Server_delete(server);
-    UA_ServerConfig_delete(config);
-    UA_Connection_deleteMembers(&c);
-}
-END_TEST
-
-static Suite *testSuite_binaryMessages(void) {
-    Suite *s = suite_create("Test server with messages stored in text files");
-    TCase *tc_messages = tcase_create("binary messages");
-    tcase_add_test(tc_messages, processMessage);
-    suite_add_tcase(s, tc_messages);
-    return s;
-}
-
-int main(int argc, char **argv) {
-    if(argc < 2)
-        return EXIT_FAILURE;
-    filenames = &argv[1];
-    files = argc - 1;
-    int number_failed = 0;
-    Suite *s;
-    SRunner *sr;
-    s  = testSuite_binaryMessages();
-    sr = srunner_create(s);
-    srunner_set_fork_status(sr, CK_NOFORK);
-    srunner_run_all(sr, CK_NORMAL);
-    number_failed += srunner_ntests_failed(sr);
-    srunner_free(sr);
-    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}

+ 0 - 30
tools/hex2bin.py

@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this 
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import sys
-import os
-from io import open
-import binascii
-import re
-
-def clean_line(string):
-    comment_re = re.compile("/\*.*?\*/") # matches C-style comments /* */ at the end of a line
-    return re.sub(comment_re, "" ,string).replace(" ","").replace("\n","")
-
-if len(sys.argv) < 2:
-    print("Usage: python hex2bin.py file1.hex file2.hex ...")
-    exit(0)
-
-filenames = sys.argv[1:]
-for f in filenames:
-    bn = os.path.basename(f)
-    with open(f, mode="rt") as ff:
-        with open(bn[:-4] + ".bin", "wb") as out:
-            lines = ff.readlines()
-            for l in lines:
-                c = clean_line(l)
-                out.write(binascii.unhexlify(c))
-