open5gs/test/testutil.c

55 lines
1.6 KiB
C
Raw Normal View History

2017-02-03 08:00:22 +00:00
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2017-02-13 09:11:09 +00:00
#include "core_debug.h"
2017-02-06 11:54:31 +00:00
#include "cellwire.h"
2017-02-13 07:25:36 +00:00
#include "context.h"
2017-02-03 08:00:22 +00:00
#include "abts.h"
#include "testutil.h"
void core_assert_ok(abts_case* tc, const char* context, status_t rv,
int lineno)
{
if (rv == CORE_ENOTIMPL)
{
abts_not_impl(tc, context, lineno);
} else if (rv != CORE_OK)
{
char buf[STRING_MAX], ebuf[128];
sprintf(buf, "%s (%d): %s\n", context, rv,
core_strerror(rv, ebuf, sizeof ebuf));
abts_fail(tc, buf, lineno);
}
}
2017-02-06 11:54:31 +00:00
void test_terminate(void)
{
2017-03-05 07:49:57 +00:00
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FULL);
2017-02-06 11:54:31 +00:00
cellwire_terminate();
}
2017-02-03 08:00:22 +00:00
void test_initialize(void)
{
2017-02-27 06:09:41 +00:00
cellwire_initialize(NULL, NULL);
2017-03-05 07:49:57 +00:00
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR);
2017-02-13 09:11:09 +00:00
2017-02-13 07:25:36 +00:00
inet_pton(AF_INET, "127.0.0.1", &mme_self()->enb_local_addr);
2017-02-06 11:54:31 +00:00
atexit(test_terminate);
2017-02-03 08:00:22 +00:00
}