%define network_state OFF
%define memory_eng ON
-%define slp_tests OFF
-
%if "%{?tizen_profile_name}" == "mobile"
%define swap_module ON
%define freezer_module ON
%description -n libresourced-devel
Library (development) for resourced (Resource Management Daemon)
-%if %{?slp_tests} == ON
-%package -n resourced-test
-Summary: Resource test tools
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description -n resourced-test
-This package include set of test programs
-%endif
-
%prep
%setup -q
-DMEMORY_MODULE=%{memory_module} \
-DWEARABLE_NOTI=%{wearable_noti} \
-DBLOCK_MODULE=%{block_module} \
- -DSLP_TESTS=%{slp_tests}
make %{?jobs:-j%jobs}
%attr(700, app, app) %{logging_storage_db_full_path}-shm
%attr(700, app, app) %{logging_storage_db_full_path}-wal
%endif
-%if %{?slp_tests} == ON
- /usr/bin/resourced-test
- /usr/lib/systemd/system/resourced-test.service
- /usr/share/dbus-1/system-services/org.tizen.system.resourced-test.service
-%endif
#memps
%attr(-,root, system) %{_bindir}/memps
#mem-stress
%{_libdir}/libresourced.so
%{_includedir}/system/data_usage.h
-%if %{?slp_tests} == ON
-%files -n resourced-test
-%defattr(-,root,root,-)
-%{_libdir}/resourced/test/test-file-helper
-%{_libdir}/resourced/test/test-smaps
-%{_libdir}/resourced/test/test-procfs
-%{_bindir}/sluggish-test
-%config /etc/resourced/sluggish-test.conf
-%endif
ADD_SUBDIRECTORY(${PROC-STAT_SOURCE_DIR})
ADD_SUBDIRECTORY(${MEMPS_SOURCE_DIR})
ADD_SUBDIRECTORY(${NETWORK_SOURCE_DIR})
-IF("${SLP_TESTS}" STREQUAL "ON")
- ADD_SUBDIRECTORY(${TEST_DIR})
-ENDIF()
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(resourced-test C)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
-
-SET(SRCS
- test.c
- main.c
-)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED edbus dlog glib-2.0)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-IF("${SLP_TESTS}" STREQUAL "ON")
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
-ELSE()
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer")
-ENDIF()
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-MESSAGE("FLAGS: ${CMAKE_C_FLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
-MESSAGE("FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DENABLE_TEST_DLOG")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-
-# test smaps
-ADD_EXECUTABLE(test-smaps ${TEST_DIR}/test-smaps.c)
-TARGET_LINK_LIBRARIES(test-smaps resourced_shared)
-INSTALL(TARGETS test-smaps DESTINATION lib/resourced/test)
-
-# test procfs
-ADD_EXECUTABLE(test-procfs ${TEST_DIR}/test-procfs.c)
-TARGET_LINK_LIBRARIES(test-procfs resourced_shared)
-INSTALL(TARGETS test-procfs DESTINATION lib/resourced/test)
-
-# test file-helper
-ADD_EXECUTABLE(test-file-helper ${TEST_DIR}/test-file-helper.c)
-TARGET_LINK_LIBRARIES(test-file-helper
- resourced_shared ${RESOURCED_REQUIRE_PKGS_LDFLAGS})
-INSTALL(TARGETS test-file-helper DESTINATION lib/resourced/test)
-
-# test autolaunch utility
-ADD_EXECUTABLE(sluggish-test ${TEST_DIR}/sluggish-test.c)
-TARGET_LINK_LIBRARIES(sluggish-test resourced_shared)
-INSTALL(TARGETS sluggish-test DESTINATION bin)
-INSTALL(FILES ${TEST_DIR}/sluggish-test.conf DESTINATION /etc/resourced)
-
-ADD_SUBDIRECTORY(activation)
+++ /dev/null
-ADD_SUBDIRECTORY(systemd)
-ADD_SUBDIRECTORY(dbus)
+++ /dev/null
-SET(SYSTEM_DBUS_SERVICE_DIR "${PREFIX}/share/dbus-1/system-services")
-
-INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.system.resourced-test.service
- DESTINATION
- ${SYSTEM_DBUS_SERVICE_DIR}
-)
+++ /dev/null
-[D-BUS Service]
-Name=org.tizen.system.ResourcedTest
-Exec=/bin/false
-SystemdService=resourced-test.service
-User=root
+++ /dev/null
-SET(SD_SYS_UNIT_DIR "${LIBDIR}/systemd/system")
-
-SET(SD_SYS_UNITS
- resourced-test.service
-)
-
-INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${SD_SYS_UNITS}
- DESTINATION
- ${SD_SYS_UNIT_DIR}
-)
+++ /dev/null
-[Unit]
-Description=Start the test service
-Requires=dbus.socket
-After=dbus.socket
-
-[Service]
-Type=dbus
-BusName=org.tizen.system.ResourcedTest
-ExecStart=/usr/bin/resourced-test
-KillSignal=SIGUSR1
+++ /dev/null
-/*
- * test
- *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-
-#include "test.h"
-
-static void test_main(int argc, char **argv)
-{
- _I("test all");
- test_init((void *)NULL);
- test_exit((void *)NULL);
-}
-
-static void unit_test(int argc, char **argv)
-{
- const struct test_ops *ops;
-
- ops = test_find(argv[1]);
- if (!ops) {
- _E("there is no test ops : %s", argv[1]);
- return;
- }
- ops->unit(argc, argv);
-}
-
-int main(int argc, char **argv)
-{
- if (argc >= 2)
- unit_test(argc, argv);
- else
- test_main(argc, argv);
- return 0;
-}
-
+++ /dev/null
-
-/*
- Copyright (c) 2015 - 2016 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.
-
- 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
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <linux/input.h>
-
-#ifdef RESOURCED_BUILD
-#include "util.h"
-#else
-static inline void closep(int *fd)
-{
- if (*fd >= 0)
- close(*fd);
-}
-
-static inline void fclosep(FILE **f)
-{
- if (*f)
- fclose(*f);
-}
-
-static inline void pclosep(FILE **f)
-{
- if (*f)
- pclose(*f);
-}
-
-#define _cleanup_close_ __attribute__((cleanup(closep)))
-#define _cleanup_fclose_ __attribute__((cleanup(fclosep)))
-#define _cleanup_pclose_ __attribute__((cleanup(pclosep)))
-#endif
-
-#define MAX_ORDER 11
-#define CMD_EXTFRAG "cat /sys/kernel/debug/extfrag/unusable_index"
-#define CMD_KILL_COUNT "grep -i 'we killed' /var/log/resourced.log | wc | awk '{print $1}'"
-#define CMD_VMSTAT "vmstat | tail -n 1"
-
-/* Various Logs file used */
-#define LOG_FILENAME "sluggish-test.log"
-#define LOG_MEMPS "memps.log"
-#define LOG_KILLED_APP "killedapps.log"
-#define LOG_MEMORY "memorystats.log"
-#define LOG_ION "ion_memory.log"
-#define LOG_DMESG "dmesg.log"
-#define MARKER_LINE "#########################################################"
-
-#define APPLIST_FILENAME "/etc/resourced/sluggish-test.conf"
-
-#define KEY_INPUT_DEVICE "/dev/input/event0"
-
-#define SWAP(a,b) do { \
- int t; \
- t = a; \
- a = b; \
- b = t; \
- } while (0)
-
-
-#define ADD_EVENT(t, c, v) { \
- .type = t, \
- .code = c, \
- .value = v, \
- }
-
-#define MAX_APP 128
-
-static int num_app;
-static char applist[MAX_APP+1][128];
-
-struct input_event events[] = {
- ADD_EVENT(1, 0x00, 0x01),
- ADD_EVENT(0, 0x00, 0x00),
- ADD_EVENT(1, 0x00, 0x00),
- ADD_EVENT(0, 0x00, 0x00),
-};
-
-struct vmstat_field {
- unsigned long r;
- unsigned long b;
- unsigned long swapused;
- unsigned long memfree;
- unsigned long membuf;
- unsigned long memcached;
- unsigned long si;
- unsigned long so;
- unsigned long bi;
- unsigned long bo;
- unsigned long in;
- unsigned long cs;
- unsigned long us;
- unsigned long sy;
- unsigned long id;
- unsigned long wa;
- unsigned long st;
-};
-
-static void send_key_event(int keycode)
-{
- int i;
- int ret;
- _cleanup_close_ int fd = -1;
-
- fd = open(KEY_INPUT_DEVICE, O_RDWR);
- if (fd < 0) {
- fprintf(stderr, "%s: Failed to open: %s : \n",
- KEY_INPUT_DEVICE, strerror(errno));
- return;
- }
- for (i = 0; i < 4; i++)
- memset(&events[i].time, 0x0, sizeof(struct timeval));
-
- events[0].code = keycode;
- events[2].code = keycode;
-
- for (i = 0; i < 4; i++) {
- ret = write(fd, &events[i], sizeof(struct input_event));
- if (ret < 0)
- return;
- }
-}
-
-static int get_kill_count(void)
-{
- FILE *fp = NULL;
- char output[32];
- int count = 0;
-
- fp = popen(CMD_KILL_COUNT, "r");
- if (fp == NULL) {
- fprintf(stderr, "[%s]: ERROR: popen failed: %s\n",
- __func__, strerror(errno));
- return -1;
- }
- if (fgets(output, sizeof(output), fp) != NULL) {
- count = atoi(output);
- }
- pclose(fp);
- return count;
-}
-
-static float get_average_fraglevel(const char *zone)
-{
- int i;
- _cleanup_pclose_ FILE *fp = NULL;
- float tmp_fraglevel, fraglevel = 0.00F;
- char discard[256], zonename[8];
-
- fp = popen(CMD_EXTFRAG, "r");
- if (fp == NULL) {
- fprintf(stderr, "ERROR: %s: Not present!\n", CMD_EXTFRAG);
- return -1;
- }
- while (fscanf(fp, "%*s %*s %*s %s", zonename) == 1) {
- if (strcmp(zonename, zone) != 0) {
- char *ret;
- ret = fgets(discard, sizeof(discard), fp);
- if (ret == NULL)
- return 0.00F;
-
- continue;
- }
-
- fraglevel = 0.00F;
- for (i = 0; i < MAX_ORDER; i++) {
- if (fscanf(fp, "%f", &tmp_fraglevel) == 1)
- fraglevel += tmp_fraglevel;
- else
- return 0.00F;
- }
- }
-
- /* Convert to summary percent value */
- fraglevel = (fraglevel * 100) / MAX_ORDER;
-
- return fraglevel;
-}
-
-static void get_vmstat_data(struct vmstat_field *vmstat)
-{
- int ret;
- FILE *fp = NULL;
- char output[256];
-
- if (vmstat == NULL) {
- fprintf(stderr, "[%s]: ERROR: vmstat is NULL! \n", __func__);
- return;
- }
- memset(output, 0, sizeof(output));
-
- fp = popen(CMD_VMSTAT, "r");
- if (fp == NULL) {
- fprintf(stderr, "[%s]: ERROR: popen failed: %s\n",
- __func__, strerror(errno));
- return;
- }
- while (fgets(output, sizeof(output), fp) != NULL) {
- ret = sscanf(output, "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
- &vmstat->r,&vmstat->b,&vmstat->swapused,&vmstat->memfree,&vmstat->membuf,
- &vmstat->memcached,&vmstat->si,&vmstat->so,&vmstat->bi,&vmstat->bo,&vmstat->in,
- &vmstat->cs,&vmstat->us,&vmstat->sy,&vmstat->id,&vmstat->wa,&vmstat->st);
- if (ret < 17) {
- fprintf(stderr, "[%s]: ERROR: can't get full vmstat "
- "output! \n", __func__);
- pclose(fp);
- return;
- }
- }
- pclose(fp);
-}
-
-
-static void generate_random_array(int *arr)
-{
- int i,j;
- int visited[MAX_APP+1] = {0,};
- static int random = 3;
-
- srand(random);
- random = rand() % num_app;
- j=1;
- for (i=0; i<num_app; i++) {
- int a,b;
- a = arr[i];
- b = arr[(i + j*random) % num_app];
- if (visited[a] || visited[b]) continue;
- SWAP(arr[a], arr[b]);
- visited[a] = visited[b] = 1;
- j++;
- }
-}
-
-static void print_date_in_logs(const char *logname)
-{
- char cmdline[128] = {0,};
- char format[64] = {0,};
- int ret;
- time_t t;
- struct tm *tmt;
-
- t = time(NULL);
- tmt = localtime(&t);
- strftime(format, sizeof(format), "%a %d/%b/%Y %T", tmt);
-
- sprintf(cmdline, "echo \"START TIME: %s\" >> %s", format, logname);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline, "echo \"======================================\" >> %s", logname);
- ret = system(cmdline);
- if (ret < 0)
- return;
-}
-
-static void dump_logs(void)
-{
- int ret;
- char cmdline[256];
-
- memset(cmdline, 0, sizeof(cmdline));
-
- print_date_in_logs(LOG_MEMORY);
- sprintf(cmdline,"free -tm >> %s", LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline,"cat /proc/buddyinfo >> %s", LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline,"cat /proc/meminfo >> %s", LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline,"cat /proc/vmstat >> %s", LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline,"cat /sys/kernel/debug/extfrag/unusable_index >> %s", LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
-
- print_date_in_logs(LOG_MEMPS);
- sprintf(cmdline,"memps -a >> %s", LOG_MEMPS);
- ret = system(cmdline);
- if (ret < 0)
- return;
-
- print_date_in_logs(LOG_ION);
- sprintf(cmdline,"cat /sys/kernel/debug/ion/heaps/ion_heap_cma_overlay >> %s", LOG_ION);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline,"cat /sys/kernel/debug/ion/heaps/ion_heap_system >> %s", LOG_ION);
- ret = system(cmdline);
- if (ret < 0)
- return;
-
- print_date_in_logs(LOG_DMESG);
- sprintf(cmdline,"dmesg -c >> %s", LOG_DMESG);
- ret = system(cmdline);
- if (ret < 0)
- return;
-
- /* Add beginning marker in all log files */
- sprintf(cmdline, "echo \"%s\" >> %s", MARKER_LINE, LOG_MEMORY);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline, "echo \"%s\" >> %s", MARKER_LINE, LOG_MEMPS);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline, "echo \"%s\" >> %s", MARKER_LINE, LOG_ION);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline, "echo \"%s\" >> %s", MARKER_LINE, LOG_DMESG);
- ret = system(cmdline);
- if (ret < 0)
- return;
- sprintf(cmdline, "echo \"%s\" >> %s", MARKER_LINE, LOG_KILLED_APP);
- ret = system(cmdline);
- if (ret < 0)
- return;
-}
-
-static void copy_files_to_storage(void)
-{
- int ret;
-
- ret = system("cp -rf /opt/usr/media/Images/* /opt/storage/sdcard/");
- if (ret < 0)
- return;
-}
-
-void populate_applist(void)
-{
- _cleanup_fclose_ FILE *fp = NULL;
- char appid[128];
-
- fp = fopen(APPLIST_FILENAME, "r");
- if (fp == NULL) {
- fprintf(stderr, "ERROR: could not open %s: %s\n",
- APPLIST_FILENAME, strerror(errno));
- return;
- }
- while (fgets(appid, sizeof(appid), fp) != NULL) {
- int len = strlen(appid);
-
- appid[len-1] = '\0';
- strncpy(applist[num_app++], appid, len);
- }
-}
-
-int get_launch_status(char *cmdline)
-{
- FILE *fp;
- char output[32];
-
- memset(output, '\0', sizeof(output));
- fp = popen(cmdline, "r");
- if (fp == NULL) {
- fprintf(stderr, "%s: Failed to open: %s : %s\n",
- __func__, cmdline, strerror(errno));
- return -1;
- }
- if (fgets(output, sizeof(output), fp) != NULL) {
- if (strstr(output, "failed") != NULL) {
- pclose(fp);
- return -1;
- }
- }
- pclose(fp);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- int i = 0;
- int count = 1;
- int ret;
- time_t t;
- struct tm *tmt;
- int index[128] = {0,};
- int totalkillcount = 0;
- char *ptr = NULL;
- int loop_count = 0;
- _cleanup_fclose_ FILE *fp = NULL;
-
- if (argc < 2) {
- fprintf(stderr, "ERROR: Usage: %s <loop count>\n", argv[0]);
- return -1;
- }
- ptr = argv[1];
- for (ptr = argv[1]; *ptr != '\0'; ptr++) {
- if (!isdigit(*ptr)) {
- fprintf(stderr, "ERROR: Usage: <loop count is not integer>\n");
- return -1;
- }
- }
- loop_count = atoi(argv[1]);
- num_app = 0;
-
- /* Populate the applist array, by reading appid from text file */
- populate_applist();
- if (num_app == 0) {
- fprintf(stderr, "ERROR: Failed to populate applist\n");
- return -1;
- }
-
- /* Remove all logs before starting the test */
- ret = system("/bin/rm -rf *.log");
- if (ret < 0)
- return -1;
- ret = system("/bin/dmesg -C");
- if (ret < 0)
- return -1;
- ret = system("/bin/echo "" > /var/log/resourced.log");
- if (ret < 0)
- return -1;
-
- fp = fopen(LOG_FILENAME, "w");
- if (fp == NULL) {
- fprintf(stderr, "%s: Failed to open: %s : %s\n",
- argv[0], LOG_FILENAME, strerror(errno));
- return -1;
- }
-
- /* Initialize random array */
- for (i = 0; i < num_app; i++)
- index[i] = i;
-
- while (count <= loop_count) {
- int i = 0;
- char cmdline[128];
- int prevkillcount = 0;
-
- memset(cmdline, 0, sizeof(cmdline));
-
- ret = system("echo "" > /var/log/resourced.log");
- if (ret < 0)
- return -1;
-
- dump_logs();
- t = time(NULL);
- tmt = localtime(&t);
- strftime(cmdline, sizeof(cmdline), "%a %d/%b/%Y %T", tmt);
- fprintf(fp, "\nLOOP#%d, START TIME: %s\n", count, cmdline);
- fprintf(fp, "==============================================\n");
-
- fflush(fp);
- fprintf(fp, "Process CPU_Usage(%%) ActualFree(MB) Reclaimable(MB) SwapUsed(MB) Fragmentation(%%) Kill Count\n");
- fprintf(fp, "--------------------------------------------- ------------ -------------- -------------- ----------- ----------------- ----------\n");
-
- for (i = 0; i < num_app; i++) {
- unsigned long actualfree=0;
- unsigned long reclaimable=0;
- unsigned long swapused = 0;
- float fraglevel = 0.00F;
- float cpu_usage = 0.00F;
- struct vmstat_field vmstat;
- int rindex = 0;
- int killcount = 0;
-
- memset(cmdline, 0, sizeof(cmdline));
- memset(&vmstat, 0, sizeof(vmstat));
- rindex = index[i];
- sprintf(cmdline,"aul_test launch %s | grep failed", applist[rindex]);
- ret = system(cmdline);
- if (ret < 0)
- return -1;
- sleep(3);
- /* Check app launch status for failure */
- ret = get_launch_status(cmdline);
- if (ret != 0) {
- fprintf(stderr, "App Launch Failed: <%s>\n", applist[rindex]);
- continue;
- }
- /* get CPU usage after 3 second of launching */
- get_vmstat_data(&vmstat);
- cpu_usage = (vmstat.us + vmstat.sy);
-
- if (strstr(applist[rindex], "camera") != NULL) {
- sleep(2);
- /* Use VOLUME-DOWN key for camera capture */
- send_key_event(115);
- sleep(2);
- }
- sleep(10);
- memset(&vmstat, 0, sizeof(vmstat));
- /* get memory status after 10 seconds of launching */
- get_vmstat_data(&vmstat);
- actualfree = vmstat.memfree/1024;
- reclaimable = (vmstat.membuf + vmstat.memcached)/1024;
- swapused = vmstat.swapused/1024;
- /* Check for fragmentation level, only for Normal zone */
- fraglevel = get_average_fraglevel("Normal");
- killcount = get_kill_count();
- if (killcount > prevkillcount)
- totalkillcount += (killcount - prevkillcount);
- prevkillcount = killcount;
- fprintf(fp, "%d) %-34s\t\t%5.2f\t\t%6lu\t\t%8lu\t%4lu\t\t%5.2f\t%20d\n",
- rindex,applist[rindex],cpu_usage,actualfree,reclaimable,swapused,fraglevel,totalkillcount);
- sleep(5);
- /* Wait for 5 more seconds before dumping logs and minimizing */
- dump_logs();
- /* Trigger Home key press event, to minimize the app */
- send_key_event(139);
- /* Wait for 2 seconds for Home screen to appear */
- sleep(2);
- fflush(fp);
- }
- /* Suffle elements in the index array, randomly */
- generate_random_array(index);
- /* Copy few files to internal/external storage, or SD card */
- copy_files_to_storage();
- sprintf(cmdline, "grep -i 'we killed' /var/log/resourced.log >> %s", LOG_KILLED_APP);
- ret = system(cmdline);
- if (ret < 0)
- return -1;
- count++;
- sleep(10);
- }
- return 0;
-}
-
+++ /dev/null
-com.samsung.phone
-com.samsung.message-lite.compose
-com.samsung.contacts
-com.samsung.music-player-lite
-com.samsung.setting
-com.samsung.myfile-lite
-com.facebook.tizen
-com.samsung.memo
-com.samsung.email
-com.samsung.fm-radio-lite
-com.samsung.weather-m
-org.tizen.tizenstore
-com.samsung.themestore
-com.samsung.dropbox
-com.here.tizen.maps
-com.samsung.browser
-com.samsung.calculator
-srfxzv8GKR.YouTube
-com.samsung.mixradio
-com.samsung.video-player-lite
-com.samsung.voicerecorder-lite
-com.samsung.calendar-lite
-com.samsung.clock-lite
-com.samsung.camera-app-lite
-com.samsung.gallery-lite
-com.tencent.wechat.mmapp
-org.tizen.webcontainer
-c4YC9v0L3i.TrueCallerUI
-net.whatsapp.WhatsApp
-kNWnnj0vTH.MyGalaxy
-iIBRPRJerv.Cricbuzz
-Ynaz8RbwZd.NewsHunt
-com.samsung.google-search
-org.tizen.tizenseckeystring
-com.gameloft.tizen.HEP.GloftANTZ
-com.games2win.worldcupcricketchamp
-com.samsung.smart-manager
+++ /dev/null
-/*
- * resourced
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "file-helper.h"
-
-#define STR_TEST_FILE "/tmp/test-file-helper-str"
-#define INT_TEST_FILE "/tmp/test-file-helper-int"
-#define UINT_TEST_FILE "/tmp/test-file-helper-uint"
-
-#define TEST_STR "hello"
-#define TEST_INT -2563
-#define TEST_UINT 3253
-
-static void test_fwrite_str(void)
-{
- int r;
- char buf[256];
-
- r = fwrite_str(STR_TEST_FILE, "test");
- if (r < 0)
- fprintf(stderr, "Error: failed to test fwrite_str: %s\n", strerror_r(-r, buf, sizeof(buf)));
-}
-
-static void test_fwrite_fread_int(void)
-{
- int i = 0;
- int r;
- char buf[256];
-
- r = fwrite_int(INT_TEST_FILE, TEST_INT);
- if (r < 0)
- fprintf(stderr, "Error: failed to test fwrite_int: %s\n", strerror_r(-r, buf, sizeof(buf)));
-
- r = fread_int(INT_TEST_FILE, &i);
- if (r < 0)
- fprintf(stderr, "Error: failed to test fread_int: %s\n", strerror_r(-r, buf, sizeof(buf)));
-
- if (i != TEST_INT)
- fprintf(stderr, "Error: read int(%d) mismatch with (%d)\n", i, TEST_INT);
-}
-
-static void test_fwrite_fread_uint(void)
-{
- uint32_t u = 0;
- int r;
- char buf[256];
-
- r = fwrite_uint(UINT_TEST_FILE, TEST_UINT);
- if (r < 0)
- fprintf(stderr, "Error: failed to test fwrite_uint: %s\n", strerror_r(-r, buf, sizeof(buf)));
-
- r = fread_uint(UINT_TEST_FILE, &u);
- if (r < 0)
- fprintf(stderr, "Error: failed to test fwrite_uint: %s\n", strerror_r(-r, buf, sizeof(buf)));
-
- if (u != TEST_UINT)
- fprintf(stderr, "Error: read uint(%u) mismatch with (%u)\n", u, TEST_UINT);
-}
-
-int main(int argc, char *argv[])
-{
- test_fwrite_str();
- test_fwrite_fread_int();
- test_fwrite_fread_uint();
-
- return 0;
-}
+++ /dev/null
-/*
- * resourced
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "util.h"
-#include "procfs.h"
-
-int main(int argc, char *argv[])
-{
-
- int ret;
- struct meminfo mitc1, mitc2;
- unsigned int swap_free;
- unsigned int mem_available;
-
- printf("# proc_get_mem_available \n");
- mem_available = proc_get_mem_available();
- printf("MemAvailable: %u MB ( %u KB)\n",
- mem_available, KBYTE_TO_BYTE(mem_available));
-
- printf("# proc_get_swap_free \n");
- swap_free = proc_get_swap_free();
- printf("SwapFree: %u KB ( %u B)\n",
- swap_free, KBYTE_TO_BYTE(swap_free));
-
- printf("# proc_get_meminfo (3 bit mask) \n");
- ret = proc_get_meminfo(&mitc1, MEMINFO_MASK_MEM_TOTAL|MEMINFO_MASK_SWAP_TOTAL|MEMINFO_MASK_VMALLOC_CHUNK);
- if (ret < 0)
- printf("Error from proc_get_meminfo error: %d \n", ret);
-
- printf("MemTotal: %u KB \nSwapTotal: %u KB \nVmallocChunk: %u KB \n",
- mitc1.value[MEMINFO_ID_MEM_TOTAL],
- mitc1.value[MEMINFO_ID_SWAP_TOTAL],
- mitc1.value[MEMINFO_ID_VMALLOC_CHUNK]);
-
- printf("# proc_get_meminfo (mask all) \n");
- ret = proc_get_meminfo(&mitc2, MEMINFO_MASK_ALL);
- if (ret < 0)
- printf("Error from proc_get_meminfo error: %d \n", ret);
-
- printf("MemTotal: %u KB \nBuffers: %u KB \nSwapTotal: %u KB \nPageTables: %u KB \nCommitLimit: %u KB \nVmallocChunk: %u KB \n",
- mitc2.value[MEMINFO_ID_MEM_TOTAL],
- mitc2.value[MEMINFO_ID_BUFFERS],
- mitc2.value[MEMINFO_ID_SWAP_TOTAL],
- mitc2.value[MEMINFO_ID_PAGE_TABLES],
- mitc2.value[MEMINFO_ID_COMMIT_LIMIT],
- mitc2.value[MEMINFO_ID_VMALLOC_CHUNK]);
-
- return 0;
-}
+++ /dev/null
-/*
- * resourced
- *
- * Copyright (c) 2015 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.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "smaps.h"
-
-int main(int argc, char *argv[])
-{
- _cleanup_smaps_free_ struct smaps *maps;
- int i, j;
- int r;
-
- r = smaps_get(atoi(argv[1]), &maps, SMAPS_MASK_ALL);
- if (r < 0) {
- fprintf(stderr, "failed\n");
- goto exit;
- }
-
-
- for (i = 0; i < maps->n_map; i++) {
- fprintf(stdout, "%x-%-15x %-10s %s\n",
- maps->maps[i]->start,
- maps->maps[i]->end,
- maps->maps[i]->mode,
- maps->maps[i]->name);
-
- for (j = 0; j < SMAPS_ID_MAX; j++) {
- fprintf(stdout, "%-23s: %u\n",
- smap_id_to_string(j),
- maps->maps[i]->value[j]);
- }
- }
-
-exit:
- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-}
+++ /dev/null
-/*
- * test
- *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-#include <glib.h>
-
-#include "test.h"
-
-static GSList *test_header;
-
-void test_add(const struct test_ops *module)
-{
- if (module->priority == TEST_PRIORITY_HIGH)
- test_header = g_slist_prepend(test_header, (gpointer)module);
- else
- test_header = g_slist_append(test_header, (gpointer)module);
-}
-
-void test_remove(const struct test_ops *module)
-{
- test_header = g_slist_remove(test_header, (gpointer)module);
-}
-
-const struct test_ops *test_find(const char *name)
-{
- GSList *iter;
- const struct test_ops *module;
-
- gslist_for_each_item(iter, test_header) {
- module = (struct test_ops *)iter->data;
- if (!strcmp(module->name, name))
- return module;
- }
- return NULL;
-}
-
-void test_init(void *data)
-{
- GSList *iter;
- const struct test_ops *module;
-
- gslist_for_each_item(iter, test_header) {
- module = (struct test_ops *)iter->data;
- _D("Initialize [%s] module\n", module->name);
- if (module->init)
- module->init(data);
- }
-}
-
-void test_exit(void *data)
-{
- GSList *iter;
- const struct test_ops *module;
-
- gslist_for_each_item(iter, test_header) {
- module = (struct test_ops *)iter->data;
- _D("Deinitialize [%s] module\n", module->name);
- if (module->exit)
- module->exit(data);
- }
-}
+++ /dev/null
-/*
- * test
- *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-
-#ifndef __TEST_H__
-#define __TEST_H__
-#include <stdio.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <E_DBus.h>
-
-#ifdef ENABLE_TEST_DLOG
-#define LOG_TAG "TEST"
-#include <dlog.h>
-#define _D(fmt, arg...) \
- do { LOGD(fmt, ##arg); } while(0)
-#define _I(fmt, arg...) \
- do { LOGI(fmt, ##arg); } while(0)
-#define _W(fmt, arg...) \
- do { LOGW(fmt, ##arg); } while(0)
-#define _E(fmt, arg...) \
- do { LOGE(fmt, ##arg); } while(0)
-#define _SD(fmt, arg...) \
- do { SECURE_LOGD(fmt, ##arg); } while(0)
-#define _SI(fmt, arg...) \
- do { SECURE_LOGI(fmt, ##arg); } while(0)
-#define _SW(fmt, arg...) \
- do { SECURE_LOGW(fmt, ##arg); } while(0)
-#define _SE(fmt, arg...) \
- do { SECURE_LOGE(fmt, ##arg); } while(0)
-#else
-#define _D(...) do { } while (0)
-#define _I(...) do { } while (0)
-#define _W(...) do { } while (0)
-#define _E(...) do { } while (0)
-#define _SD(...) do { } while (0)
-#define _SI(...) do { } while (0)
-#define _SW(...) do { } while (0)
-#define _SE(...) do { } while (0)
-#endif
-
-
-#define gslist_for_each_item(item, list) \
- for(item = list; item != NULL; item = g_slist_next(item))
-
-#define TEST_WAIT_TIME_INTERVAL 2
-
-enum test_priority {
- TEST_PRIORITY_NORMAL = 0,
- TEST_PRIORITY_HIGH,
-};
-
-struct test_ops {
- enum test_priority priority;
- char *name;
- void (*init) (void *data);
- void (*exit) (void *data);
- int (*start) (void);
- int (*stop) (void);
- int (*status) (void);
- int (*unit) (int argc, char **argv);
-};
-
-enum test_ops_status {
- TEST_OPS_STATUS_UNINIT,
- TEST_OPS_STATUS_START,
- TEST_OPS_STATUS_STOP,
- TEST_OPS_STATUS_MAX,
-};
-
-void test_init(void *data);
-void test_exit(void *data);
-
-static inline int test_start(const struct test_ops *c)
-{
- if (c && c->start)
- return c->start();
-
- return -EINVAL;
-}
-
-static inline int test_stop(const struct test_ops *c)
-{
- if (c && c->stop)
- return c->stop();
-
- return -EINVAL;
-}
-
-static inline int test_get_status(const struct test_ops *c)
-{
- if (c && c->status)
- return c->status();
-
- return -EINVAL;
-}
-
-#define TEST_OPS_REGISTER(c) \
-static void __CONSTRUCTOR__ module_init(void) \
-{ \
- test_add(c); \
-} \
-static void __DESTRUCTOR__ module_exit(void) \
-{ \
- test_remove(c); \
-}
-
-void test_add(const struct test_ops *c);
-void test_remove(const struct test_ops *c);
-const struct test_ops *test_find(const char *name);
-#endif