Scripts for unit tests. 14/17214/1
authorPrzemyslaw Kedzierski <p.kedzierski@samsung.com>
Wed, 5 Mar 2014 11:15:42 +0000 (12:15 +0100)
committerPrzemyslaw Kedzierski <p.kedzierski@samsung.com>
Wed, 5 Mar 2014 11:27:50 +0000 (12:27 +0100)
Scripts needed for unit testing API functions.

Change-Id: I0bdd27ca6edb215d58fe05093b9a955685ec6813
Signed-off-by: Przemyslaw Kedzierski <p.kedzierski@samsung.com>
15 files changed:
test/_export_env.sh [new file with mode: 0755]
test/_export_target_env.sh [new file with mode: 0755]
test/build.sh [new file with mode: 0755]
test/clean.sh [new file with mode: 0755]
test/config [new file with mode: 0755]
test/execute.sh [new file with mode: 0755]
test/gbs_setup.sh [new file with mode: 0755]
test/push.sh [new file with mode: 0755]
test/testcase/Makefile [new file with mode: 0755]
test/testcase/tslist [new file with mode: 0755]
test/testcase/utc_system_rd_network.c [new file with mode: 0755]
test/tet_scen [new file with mode: 0755]
test/tetbuild.cfg [new file with mode: 0755]
test/tetclean.cfg [new file with mode: 0755]
test/tetexec.cfg [new file with mode: 0755]

diff --git a/test/_export_env.sh b/test/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/test/_export_target_env.sh b/test/_export_target_env.sh
new file mode 100755 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/test/build.sh b/test/build.sh
new file mode 100755 (executable)
index 0000000..d58c039
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/test/clean.sh b/test/clean.sh
new file mode 100755 (executable)
index 0000000..29743e0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./                                # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/test/config b/test/config
new file mode 100755 (executable)
index 0000000..03824c9
--- /dev/null
@@ -0,0 +1,3 @@
+PKG_NAME=librd-network
+TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TETware
+TET_INSTALL_TARGET_PATH=/opt/home/TETware
diff --git a/test/execute.sh b/test/execute.sh
new file mode 100755 (executable)
index 0000000..a4f6095
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. ./_export_target_env.sh                    # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/test/gbs_setup.sh b/test/gbs_setup.sh
new file mode 100755 (executable)
index 0000000..cbfe8a5
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+sudo mkdir -p ~/GBS-ROOT/8974-eur-open/local/BUILD-ROOTS/scratch.armv7l.0/var/tmp/dts_fw
+sudo mount -o bind . ~/GBS-ROOT/8974-eur-open/local/BUILD-ROOTS/scratch.armv7l.0/var/tmp/dts_fw
+gbs chroot -r ~/GBS-ROOT/8974-eur-open/local/BUILD-ROOTS/scratch.armv7l.0
+
+# do somgthing...
+
+sudo umount ~/GBS-ROOT/8974-eur-open/local/BUILD-ROOTS/scratch.armv7l.0/var/tmp/dts_fw
diff --git a/test/push.sh b/test/push.sh
new file mode 100755 (executable)
index 0000000..2bbab27
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./config
+
+TC_PATH=/opt/home/$PKG_NAME
+
+echo $TC_PATH
+
+sdb root on
+sdb shell "mkdir -p $TC_PATH"
+sdb push . $TC_PATH
diff --git a/test/testcase/Makefile b/test/testcase/Makefile
new file mode 100755 (executable)
index 0000000..8b0c656
--- /dev/null
@@ -0,0 +1,28 @@
+CC = gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = system-resource
+
+#TET_ROOT = /home/idkiller/work/tetware/TETware/tetware-target
+
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDFLAGS += `pkg-config --libs $(PKGS)`
+
+CFLAGS += `pkg-config --cflags $(PKGS)`
+CFLAGS += -I.
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TCS)
diff --git a/test/testcase/tslist b/test/testcase/tslist
new file mode 100755 (executable)
index 0000000..16d4768
--- /dev/null
@@ -0,0 +1 @@
+/testcase/utc_system_rd_network
diff --git a/test/testcase/utc_system_rd_network.c b/test/testcase/utc_system_rd_network.c
new file mode 100755 (executable)
index 0000000..e16dfb9
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * resourced
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed 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.
+ */
+
+
+/*
+ * @file utc_system_rd_network.c
+ *
+ * @desc Core API testcase
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ */
+#include <tet_api.h>
+#include <resourced.h>
+#include <rd-network.h>
+
+#define API_NAME_NETWORK_GET_RESTRICTION_STATE "network_get_restriction_state"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_system_network_get_restriction_state_p(void);
+static void utc_system_network_get_restriction_state_n(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_system_network_get_restriction_state_p, POSITIVE_TC_IDX },
+       { utc_system_network_get_restriction_state_n, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of network_get_restriction_state()
+ */
+static void utc_system_network_get_restriction_state_p(void)
+{
+       int ret;
+       network_restriction_state state;
+
+       ret = network_get_restriction_state(RESOURCED_ALL_APP, NETWORK_IFACE_ALL, &state);
+
+       dts_check_eq(API_NAME_NETWORK_GET_RESTRICTION_STATE, ret, NETWORK_ERROR_NONE);
+}
+
+/**
+ * @brief Negative test case of network_get_restriction_state()
+ */
+static void utc_system_network_get_restriction_state_n(void)
+{
+       int ret;
+       network_restriction_state state;
+
+       ret = network_get_restriction_state(RESOURCED_ALL_APP, NETWORK_IFACE_ALL, NULL);
+
+       dts_check_ne(API_NAME_NETWORK_GET_RESTRICTION_STATE, ret, NETWORK_ERROR_NONE);
+}
diff --git a/test/tet_scen b/test/tet_scen
new file mode 100755 (executable)
index 0000000..03f029a
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/testcase/tslist
diff --git a/test/tetbuild.cfg b/test/tetbuild.cfg
new file mode 100755 (executable)
index 0000000..f7eda55
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/test/tetclean.cfg b/test/tetclean.cfg
new file mode 100755 (executable)
index 0000000..2a0477a
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/test/tetexec.cfg b/test/tetexec.cfg
new file mode 100755 (executable)
index 0000000..ef3e452
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?