summaryrefslogtreecommitdiff
path: root/logger/logger-dev-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'logger/logger-dev-test.c')
-rw-r--r--logger/logger-dev-test.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/logger/logger-dev-test.c b/logger/logger-dev-test.c
deleted file mode 100644
index c646f7c..0000000
--- a/logger/logger-dev-test.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Linaro
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Linaro <linaro-dev@lists.linaro.org>
- *******************************************************************************/
-
-/*
- * logger-dev-test.c Trivial Android logger-dev unit test
- *
- * By: AppalaNaidu Bade <appala.bade@linaro.org>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef UBUNTU_LOGGER
-
-#define LOGGER_LOG_RADIO "/dev/log_radio"
-#define LOGGER_LOG_EVENTS "/dev/log_events"
-#define LOGGER_LOG_SYSTEM "/dev/log_system"
-#define LOGGER_LOG_MAIN "/dev/log_main"
-
-#else
-
-#define LOGGER_LOG_RADIO "/dev/log/radio"
-#define LOGGER_LOG_EVENTS "/dev/log/events"
-#define LOGGER_LOG_SYSTEM "/dev/log/system"
-#define LOGGER_LOG_MAIN "/dev/log/main"
-
-#endif // UBUNTU_LOGGER
-
-#define __LOGGERIO 0xAE
-#define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */
-#define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */
-#define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */
-#define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */
-#define LOGGER_GET_VERSION _IO(__LOGGERIO, 5) /* abi version */
-#define LOGGER_SET_VERSION _IO(__LOGGERIO, 6) /* abi version */
-
-void show_help()
-{
- printf("Usage:\n loggerdevtest logdevicename(main/events/radio/system)\n\n");
- return;
-}
-
-int clearlog(int logfd)
-{
- return ioctl(logfd, LOGGER_FLUSH_LOG);
-}
-
-int getlogsize(int logfd)
-{
- return ioctl(logfd, LOGGER_GET_LOG_BUF_SIZE);
-}
-
-int getlogreadablesize(int logfd)
-{
- return ioctl(logfd, LOGGER_GET_LOG_LEN);
-}
-
-int getlognextentrysize(int logfd)
-{
- return ioctl(logfd, LOGGER_GET_NEXT_ENTRY_LEN);
-}
-
-int main(int argc, char *argv[])
-{
- char *logdevicename;
- int log_fd;
- int log_ret;
-
- if (argc !=2) {
- show_help();
- exit(0);
- }
- if (strcmp(argv[argc-1],"help") == 0) {
- show_help();
- exit(0);
- }
- if(strcmp(argv[argc-1],"main")==0)
- logdevicename = LOGGER_LOG_MAIN;
- else if(strcmp(argv[argc-1], "events")==0)
- logdevicename = LOGGER_LOG_EVENTS;
- else if(strcmp(argv[argc-1], "radio")==0)
- logdevicename = LOGGER_LOG_RADIO;
- else if(strcmp(argv[argc-1], "system")==0)
- logdevicename = LOGGER_LOG_SYSTEM;
- else {
- printf("wrong input check usage and try again\n");
- exit(0);
- }
-
- log_fd = open(logdevicename,O_RDWR);
- if (log_fd < 0) {
- printf("FAIL :Failed to open %s \n",logdevicename);
- exit(EXIT_FAILURE);
- } else
- printf("PASS :Able to open %s logdevice and fd is %d\n", logdevicename,log_fd);
-
- log_ret = getlogsize(log_fd);
- if(log_ret < 0) {
- printf("FAIL : Failed to get %s logdevice size \n ", logdevicename);
- perror("ioctl:\n");
- } else
- printf("PASS : %s logdevice size = %d\n",logdevicename,log_ret);
- log_ret = getlogreadablesize(log_fd);
- if(log_ret < 0){
- printf("FAIL : Failed to get %s logdevice readablesize\n", logdevicename);
- perror("ioctl:\n");
- } else
- printf("PASS : %s logdevice readablesize = %d\n", logdevicename,log_ret);
- log_ret = getlognextentrysize(log_fd);
- if(log_ret < 0) {
- printf("FAIL : Failed to get %s logdevice size of next log entry\n" , logdevicename);
- perror("ioctl:\n");
- } else
- printf("PASS : %s logdevice size of next log entry = %d\n", logdevicename,log_ret);
-
- log_ret = clearlog(log_fd);
- if(log_ret) {
- printf("FAIL : Failed to clear the log of data %s logdevice\n" , logdevicename);
- perror("ioctl:\n");
- } else
- printf("PASS : clears the log of data %s logdevice\n" , logdevicename);
- close(log_fd);
- exit(0);
-
-}
-