Merge branch 'master' of gitee.com:openharmony/kernel_liteos_a into master

This commit is contained in:
guweijie 2021-05-18 09:56:42 +08:00 committed by Gitee
commit 2534c86d6f
172 changed files with 3369 additions and 2473 deletions

View File

@ -67,6 +67,7 @@ lite_subsystem("kernel") {
}
} else {
deps = [ ":make" ]
deps += [ "//kernel/liteos_a/testsuites/unittest:unittest" ]
}
}

13
Kconfig
View File

@ -165,6 +165,7 @@ config THUMB
default n
help
Answer Y to build thumb version. This will make LiteOS smaller.
config PLATFORM_DVFS
bool "Enable Dvfs"
default n
@ -173,6 +174,12 @@ config PLATFORM_DVFS
Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for
low power consumption.
config SAVE_EXCINFO
bool "Enable Saving Exception Information"
default n
help
Answer Y to enable LiteOS support saving exception information to storage medium.
config DEBUG_VERSION
bool "Enable a Debug Version"
default n
@ -315,6 +322,12 @@ menu "Security"
source "../../kernel/liteos_a/security/Kconfig"
endmenu
menu "Test"
config ENABLE_KERNEL_TEST
bool "Enable Kernel Test"
default n
endmenu
menu "Stack Smashing Protector (SSP) Compiler Feature"
choice

View File

@ -27,7 +27,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include ../.config
LITEOSTOPDIR = $(shell pwd)/../
include $(LITEOSTOPDIR)/.config
include ./config.mk
include ./module.mk
HIDE := @

View File

@ -55,6 +55,6 @@ COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
# alias variable config
HIDE := @
MAKE := make
RM := -rm -rf
CP := -cp -rf
MV := -mv
RM := rm -rf
CP := cp -rf
MV := mv -f

View File

@ -49,7 +49,7 @@
int main(int argc, char * const *argv)
{
int ret;
const char *shellPath = "/bin/shell";
const char *shellPath = "/bin/mksh";
#ifdef LOSCFG_QUICK_START
const char *samplePath = "/dev/shm/sample_quickstart";
@ -74,6 +74,11 @@ int main(int argc, char * const *argv)
if (ret < 0) {
printf("Failed to fork for shell\n");
} else if (ret == 0) {
ret = tcsetpgrp(STDIN_FILENO, getpgrp());
if (ret != 0) {
printf("tcsetpgrp failed, pgrpid %d, errno %d\n", getpgrp(), errno);
exit(0);
}
(void)execve(shellPath, NULL, NULL);
exit(0);
}

67
apps/mksh/Makefile Executable file
View File

@ -0,0 +1,67 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MKSH := mksh
MKSH_DIR := $(shell pwd)/
LITEOSTOPDIR = $(MKSH_DIR)/../../
include $(MKSH_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
BUILD_DIR := $(MKSH_DIR)/build
BUILD_LOG := $(MKSH_DIR)/build.log
TARGET_OS := OpenHarmony
LOCAL_CFLAGS := -flto -fdata-sections -ffunction-sections -Oz -fstack-protector-strong -D_FORTIFY_SOURCE=2 -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4
LOCAL_CFLAGS += --target=arm-liteos --sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/
LOCAL_CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1
LOCAL_CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
all:$(MKSH)
$(MKSH):
ifneq ($(wildcard $(BUILD_DIR)/Rebuild.sh),)
$(HIDE)echo "not clean, rebuilding now"
$(HIDE)chmod +x $(BUILD_DIR)/Rebuild.sh
$(HIDE)cd $(BUILD_DIR) && ./Rebuild.sh > $(BUILD_LOG) 2>&1
else
$(HIDE)mkdir -p $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(MKSH)/. $(BUILD_DIR)
$(HIDE)chmod +x $(BUILD_DIR)/Build.sh
$(HIDE)cd $(BUILD_DIR) && CC=$(CC) TARGET_OS=$(TARGET_OS) CFLAGS="$(LOCAL_CFLAGS)" LDFLAGS="$(LDFLAGS)" ./Build.sh -r > $(BUILD_LOG) 2>&1
endif
$(HIDE)$(CP) -rf $(BUILD_DIR)/$(MKSH) .
$(HIDE)$(STRIP) $(MKSH)
$(HIDE)mkdir -p $(APPS_OUT)
$(HIDE)$(CP) $(MKSH) $(APPS_OUT)
clean:
$(HIDE)$(RM) $(MKSH) $(BUILD_DIR) $(BUILD_LOG)
.PHONY: all $(MKSH) clean

View File

@ -29,7 +29,7 @@
APP_SUBDIRS :=
##compile modules config##
##build modules config##
ifeq ($(LOSCFG_SHELL), y)
APP_SUBDIRS += shell
@ -42,3 +42,11 @@ endif
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
APP_SUBDIRS += tftp
endif
#only enable for qemu now
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
APP_SUBDIRS += mksh
ifeq ($(WHEN_TOYBOX_IS_READY), y)
APP_SUBDIRS += toybox
endif
endif

View File

@ -345,6 +345,11 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
exit(1);
}
ret = tcsetpgrp(STDIN_FILENO, getpgrp());
if (ret != 0) {
printf("tcsetpgrp failed, pgrpid %d, errno %d\n", getpgrp(), errno);
}
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
if (ret == -1) {
perror("execve");

59
apps/toybox/Makefile Normal file
View File

@ -0,0 +1,59 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TOYBOX:= toybox
TOYBOX_DIR := $(shell pwd)
LITEOSTOPDIR = $(TOYBOX_DIR)/../../
include $(TOYBOX_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
BUILD_DIR := $(TOYBOX_DIR)/build
BUILD_LOG := $(TOYBOX_DIR)/build.log
OUTNAME := $(TOYBOX)
$(TOYBOX):
ifneq ($(wildcard $(BUILD_DIR)),)
$(HIDE)echo "not clean, rebuilding now";
else
$(HIDE)mkdir $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(TOYBOX)/. $(BUILD_DIR)
endif
$(HIDE)CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=arm-liteos \
--sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/" CC="$(CC)" OUTNAME=$(OUTNAME) \
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
$(HIDE)$(CP) $(BUILD_DIR)/$(TOYBOX) .
$(HIDE)$(STRIP) $(TOYBOX)
$(HIDE)mkdir -p $(APPS_OUT)
$(HIDE)$(CP) $(TOYBOX) $(APPS_OUT)
clean:
$(HIDE)$(RM) $(TOYBOX) $(BUILD_DIR) $(BUILD_LOG)
.PHONY: all $(TOYBOX) clean

View File

@ -40,11 +40,6 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE VOID OsSetCurrCpuSp(UINTPTR regSp)
{
__asm__ __volatile__("mov sp, %0" :: "r"(regSp));
}
#define OS_SYSTEM_NORMAL 0
#define OS_SYSTEM_EXC_CURR_CPU 1
#define OS_SYSTEM_EXC_OTHER_CPU 2

View File

@ -34,8 +34,7 @@
#include "los_base.h"
#include "los_hw.h"
#include "los_process_pri.h"
#include "los_signal.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
@ -56,23 +55,44 @@ typedef struct {
UINT32 regFPSCR; /* FPSCR */
UINT32 regFPEXC; /* FPEXC */
#endif
UINT32 resved; /* It's stack 8 aligned */
UINT32 regPSR;
UINT32 R[GEN_REGS_NUM]; /* R0-R12 */
UINT32 SP; /* R13 */
UINT32 LR; /* R14 */
UINT32 PC; /* R15 */
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
/* It has the same structure as IrqContext */
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 USP; /**< User mode sp register */
UINT32 ULR; /**< User mode lr register */
UINT32 R0;
UINT32 R1;
UINT32 R2;
UINT32 R3;
UINT32 R12;
UINT32 LR;
UINT32 PC;
UINT32 regCPSR;
} TaskContext;
typedef struct {
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
UINT64 D[FP_REGS_NUM]; /* D0-D31 */
UINT32 regFPSCR; /* FPSCR */
UINT32 regFPEXC; /* FPEXC */
#endif
UINT32 resved;
TASK_IRQ_CONTEXT
} TaskIrqContext;
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 USP; /**< User mode sp register */
UINT32 ULR; /**< User mode lr register */
UINT32 R0;
UINT32 R1;
UINT32 R2;
UINT32 R3;
UINT32 R12;
UINT32 LR;
UINT32 PC;
UINT32 regCPSR;
} IrqContext;
/*
* Description : task stack initialization
@ -82,8 +102,9 @@ typedef struct {
* Return : pointer to the task context
*/
extern VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag);
extern VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB);
extern VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack);
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStask, UINT32 parentStackSize);
extern VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
extern VOID OsInitSignalContext(VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
extern void arm_clean_cache_range(UINTPTR start, UINTPTR end);
extern void arm_inv_cache_range(UINTPTR start, UINTPTR end);

View File

@ -892,9 +892,9 @@ STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached)
length = sizeof(mmuKernelMappings) / sizeof(LosArchMmuInitMapping);
for (i = 0; i < length; i++) {
kernelMap = &mmuKernelMappings[i];
if (uncached) {
flags |= VM_MAP_REGION_FLAG_UNCACHED;
}
if (uncached) {
kernelMap->flags |= VM_MAP_REGION_FLAG_UNCACHED;
}
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
if (status != (kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {

View File

@ -32,6 +32,7 @@
#include "asm.h"
#include "arch_config.h"
.extern OsSaveSignalContext
.extern OsSchedToUserReleaseLock
.global OsTaskSchedule
.global OsTaskContextLoad
@ -85,17 +86,16 @@
*/
OsTaskSchedule:
MRS R2, CPSR
STMFD SP!, {LR}
STMFD SP!, {LR}
/* jump sp */
SUB SP, SP, #4
/* push r0-r12*/
STMFD SP!, {R0-R12}
STMFD SP!, {R2}
STMFD SP!, {LR}
STMFD SP!, {LR}
STMFD SP!, {R12}
/* 8 bytes stack align */
SUB SP, SP, #4
/* jump R0 - R3 USP, ULR reserved */
SUB SP, SP, #(8 * 4)
/* push R4 - R11*/
STMFD SP!, {R4-R11}
/* save fpu registers */
PUSH_FPU_REGS R2
@ -113,131 +113,86 @@ OsTaskContextLoad:
/* restore fpu registers */
POP_FPU_REGS R2
/* 8 bytes stack align */
ADD SP, SP, #4
LDMFD SP!, {R0}
MOV R4, R0
AND R0, R0, #CPSR_MASK_MODE
LDMFD SP!, {R4-R11}
LDR R3, [SP, #(11 * 4)]
AND R0, R3, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE
BNE OsKernelTaskLoad
MVN R2, #CPSR_INT_DISABLE
AND R3, R3, R2
STR R3, [SP, #(11 * 4)]
#ifdef LOSCFG_KERNEL_SMP
/* 8 bytes stack align */
SUB SP, SP, #4
BL OsSchedToUserReleaseLock
ADD SP, SP, #4
#endif
MVN R3, #CPSR_INT_DISABLE
AND R4, R4, R3
MSR SPSR_cxsf, R4
/* restore r0-r12, lr */
LDMFD SP!, {R0-R12}
/* jump sp, reserved */
ADD SP, SP, #(2 * 4)
LDMFD SP, {R13, R14}^
ADD SP, SP, #(2 * 4)
LDMFD SP!, {PC}^
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
OsKernelTaskLoad:
MSR SPSR_cxsf, R4
/* restore r0-r12, lr */
LDMFD SP!, {R0-R12}
ADD SP, SP, #4
LDMFD SP!, {LR, PC}^
ADD SP, SP, #(4 * 4)
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
OsIrqHandler:
SUB LR, LR, #4
/* push r0-r3 to irq stack */
STMFD SP, {R0-R3}
SUB R0, SP, #(4 * 4)
MRS R1, SPSR
MOV R2, LR
/* Save pc and cpsr to svc sp, ARMv6 and above support */
SRSFD #0x13!
/* disable irq, switch to svc mode */
CPSID i, #0x13
/* push spsr and pc in svc stack */
STMFD SP!, {R1, R2}
STMFD SP, {LR}
AND R3, R1, #CPSR_MASK_MODE
CMP R3, #CPSR_USER_MODE
BNE OsIrqFromKernel
/* push user sp, lr in svc stack */
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
OsIrqFromKernel:
/* from svc not need save sp and lr */
SUB SP, SP, #(2 * 4)
/* pop r0-r3 form irq stack*/
LDMFD R0, {R0-R3}
/* push caller saved regs as trashed regs in svc stack */
STMFD SP!, {R0-R3, R12}
/* 8 bytes stack align */
SUB SP, SP, #4
SUB SP, SP, #(4 * 4)
STR R4, [SP, #0]
/*
* save fpu regs in case in case those been
* altered in interrupt handlers.
*/
PUSH_FPU_REGS R0
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
PUSH {R4}
MOV R4, SP
EXC_SP_SET __svc_stack_top, OS_EXC_SVC_STACK_SIZE, R1, R2
#endif
BLX HalIrqHandler
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
MOV SP, R4
POP {R4}
#endif
/* process pending signals */
BL OsTaskProcSignal
BL OsSchedIrqEndCheckNeedSched
MOV R0,SP
MOV R1,R7
BL OsSaveSignalContextIrq
BLX OsTaskProcSignal
BLX OsSchedIrqEndCheckNeedSched
/* restore fpu regs */
POP_FPU_REGS R0
POP_FPU_REGS R0
LDR R4, [SP, #0]
ADD SP, SP, #4
OsIrqContextRestore:
LDR R0, [SP, #(4 * 7)]
MSR SPSR_cxsf, R0
AND R0, R0, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE
LDMFD SP!, {R0-R3, R12}
BNE OsIrqContextRestoreToKernel
/* Obtain the CPSR to determine the mode the system is in when the interrupt is triggered */
LDR R3, [SP, #(11 * 4)]
AND R1, R3, #CPSR_MASK_MODE
CMP R1, #CPSR_USER_MODE
BNE 1f
MOV R0, SP
STR R7, [SP, #0]
/* sp - sizeof(IrqContext) */
SUB SP, SP, #(12 * 4)
MOV R1, SP
BLX OsSaveSignalContext
MOV SP, R0
1:
ADD SP, SP, #(2 * 4)
/* load user sp and lr, and jump cpsr */
LDMFD SP, {R13, R14}^
ADD SP, SP, #(3 * 4)
/* return to user mode */
LDMFD SP!, {PC}^
OsIrqContextRestoreToKernel:
/* svc mode not load sp */
ADD SP, SP, #4
LDMFD SP!, {LR}
/* jump cpsr and return to svc mode */
ADD SP, SP, #4
LDMFD SP!, {PC}^
ADD SP, SP, #(2 * 4)
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
FUNCTION(ArchSpinLock)
mov r1, #1

View File

@ -34,7 +34,7 @@
#include "los_printf_pri.h"
#include "los_task_pri.h"
#include "los_hw_pri.h"
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#include "los_excinfo_pri.h"
#endif
#ifdef LOSCFG_EXC_INTERACTION
@ -104,11 +104,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
(IS_ALIGNED((ptr), sizeof(CHAR *))))
STATIC const StackInfo g_excStack[] = {
{ &__undef_stack, OS_EXC_UNDEF_STACK_SIZE, "udf_stack" },
{ &__abt_stack, OS_EXC_ABT_STACK_SIZE, "abt_stack" },
{ &__fiq_stack, OS_EXC_FIQ_STACK_SIZE, "fiq_stack" },
{ &__svc_stack, OS_EXC_SVC_STACK_SIZE, "svc_stack" },
{ &__irq_stack, OS_EXC_IRQ_STACK_SIZE, "irq_stack" },
{ &__exc_stack, OS_EXC_STACK_SIZE, "exc_stack" }
};
@ -529,7 +525,7 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
}
}
STATIC VOID OsExcRestore(UINTPTR taskStackPointer)
STATIC VOID OsExcRestore(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
@ -540,8 +536,6 @@ STATIC VOID OsExcRestore(UINTPTR taskStackPointer)
OsPercpuGet()->excFlag = CPU_RUNNING;
#endif
OsPercpuGet()->taskLockCnt = 0;
OsSetCurrCpuSp(taskStackPointer);
}
STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
@ -568,19 +562,20 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
#endif
runProcess->processStatus &= ~OS_PROCESS_FLAG_EXIT;
OsExcRestore(excBufAddr->SP);
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_FS_VFS
OsWakeConsoleSendTask();
#endif
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
OsProcessExitCodeCoreDumpSet(runProcess);
#endif
OsProcessExitCodeSignalSet(runProcess, SIGUSR2);
/* Exception handling All operations should be kept prior to that operation */
OsExcRestore();
/* kill user exc process */
LOS_Exit(OS_PRO_EXIT_OK);
@ -829,7 +824,7 @@ VOID OsTaskBackTrace(UINT32 taskID)
}
PRINTK("TaskName = %s\n", taskCB->taskName);
PRINTK("TaskID = 0x%x\n", taskCB->taskID);
BackTrace(((TaskContext *)(taskCB->stackPointer))->R[11]); /* R11 : FP */
BackTrace(((TaskContext *)(taskCB->stackPointer))->R11); /* R11 : FP */
}
VOID OsBackTrace(VOID)
@ -966,7 +961,7 @@ STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
}
}
STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
STATIC VOID OsCheckAllCpuStatus(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 ret, target;
@ -986,7 +981,7 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
} else if (g_excFromUserMode[currCpuID] == TRUE) {
if (OsCurrProcessGet()->processID == g_currHandleExcPID) {
LOS_SpinUnlock(&g_excSerializerSpin);
OsExcRestore(taskStackPointer);
OsExcRestore();
while (1) {
ret = LOS_TaskSuspend(OsCurrTaskGet()->taskID);
PrintExcInfo("%s supend task :%u failed: 0x%x\n", __FUNCTION__, OsCurrTaskGet()->taskID, ret);
@ -1014,12 +1009,11 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
}
#endif
STATIC VOID OsCheckCpuStatus(UINTPTR taskStackPointer)
STATIC VOID OsCheckCpuStatus(VOID)
{
#if (LOSCFG_KERNEL_SMP == YES)
OsCheckAllCpuStatus(taskStackPointer);
OsCheckAllCpuStatus();
#else
(VOID)taskStackPointer;
g_currHandleExcCpuID = ArchCurrCpuid();
#endif
}
@ -1040,7 +1034,7 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
g_excFromUserMode[ArchCurrCpuid()] = FALSE;
}
OsCheckCpuStatus(excBufAddr->SP);
OsCheckCpuStatus();
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
while (1) {
@ -1086,6 +1080,22 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
}
}
#ifdef LOSCFG_SAVE_EXCINFO
STATIC VOID OsSysStateSave(UINT32 *intCount, UINT32 *lockCount)
{
*intCount = g_intCount[ArchCurrCpuid()];
*lockCount = OsPercpuGet()->taskLockCnt;
g_intCount[ArchCurrCpuid()] = 0;
OsPercpuGet()->taskLockCnt = 0;
}
STATIC VOID OsSysStateRestore(UINT32 intCount, UINT32 lockCount)
{
g_intCount[ArchCurrCpuid()] = intCount;
OsPercpuGet()->taskLockCnt = lockCount;
}
#endif
/*
* Description : EXC handler entry
* Input : excType --- exc type
@ -1093,6 +1103,11 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
*/
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
{
#ifdef LOSCFG_SAVE_EXCINFO
UINT32 intCount;
UINT32 lockCount;
#endif
/* Task scheduling is not allowed during exception handling */
OsPercpuGet()->taskLockCnt++;
@ -1106,18 +1121,18 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsAllCpuStatusOutput();
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
log_read_write_fn func = GetExcInfoRW();
#endif
if (g_excHook != NULL) {
if (g_curNestCount[ArchCurrCpuid()] == 1) {
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
if (func != NULL) {
SetExcInfoIndex(0);
g_intCount[ArchCurrCpuid()] = 0;
OsSysStateSave(&intCount, &lockCount);
OsRecordExcInfoTime();
g_intCount[ArchCurrCpuid()] = 1;
OsSysStateRestore(intCount, lockCount);
}
#endif
g_excHook(excType, excBufAddr, far, fsr);
@ -1125,12 +1140,12 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsCallStackInfo();
}
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
if (func != NULL) {
PrintExcInfo("Be sure flash space bigger than GetExcInfoIndex():0x%x\n", GetExcInfoIndex());
g_intCount[ArchCurrCpuid()] = 0;
OsSysStateSave(&intCount, &lockCount);
func(GetRecordAddr(), GetRecordSpace(), 0, GetExcInfoBuf());
g_intCount[ArchCurrCpuid()] = 1;
OsSysStateRestore(intCount, lockCount);
}
#endif
}

View File

@ -32,7 +32,6 @@
#include "los_hw_pri.h"
#include "los_task_pri.h"
/* support cpu vendors */
CpuVendor g_cpuTable[] = {
/* armv7-a */
@ -72,13 +71,10 @@ VOID OsTaskEntrySetupLoopFrame(UINT32 arg0)
LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag)
{
UINT32 index = 1;
TaskContext *taskContext = NULL;
if (initFlag == TRUE) {
OsStackInit(topStack, stackSize);
}
taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
TaskContext *taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
/* initialize the task context */
#ifdef LOSCFG_GDB
@ -87,22 +83,17 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
taskContext->PC = (UINTPTR)OsTaskEntry;
#endif
taskContext->LR = (UINTPTR)OsTaskExit; /* LR should be kept, to distinguish it's THUMB or ARM instruction */
taskContext->resved = 0x0;
taskContext->R[0] = taskID; /* R0 */
taskContext->R[index++] = 0x01010101; /* R1, 0x01010101 : reg initialed magic word */
for (; index < GEN_REGS_NUM; index++) {
taskContext->R[index] = taskContext->R[index - 1] + taskContext->R[1]; /* R2 - R12 */
}
taskContext->R0 = taskID; /* R0 */
#ifdef LOSCFG_INTERWORK_THUMB
taskContext->regPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
taskContext->regCPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
#else
taskContext->regPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
taskContext->regCPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
#endif
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
/* 0xAAA0000000000000LL : float reg initialed magic word */
for (index = 0; index < FP_REGS_NUM; index++) {
for (UINT32 index = 0; index < FP_REGS_NUM; index++) {
taskContext->D[index] = 0xAAA0000000000000LL + index; /* D0 - D31 */
}
taskContext->regFPSCR = 0;
@ -112,32 +103,38 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
return (VOID *)taskContext;
}
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB)
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize)
{
TaskContext *context = (TaskContext *)childTaskCB->stackPointer;
VOID *cloneStack = (VOID *)(((UINTPTR)parentTaskCB->topOfStack + parentTaskCB->stackSize) - sizeof(TaskContext));
VOID *cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
LOS_ASSERT(parentTaskCB->taskStatus & OS_TASK_STATUS_RUNNING);
(VOID)memcpy_s(childTaskCB->stackPointer, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
context->R[0] = 0;
(VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
((TaskContext *)childStack)->R0 = 0;
}
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack)
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack)
{
LOS_ASSERT(context != NULL);
#ifdef LOSCFG_INTERWORK_THUMB
context->regPSR = PSR_MODE_USR_THUMB;
context->regCPSR = PSR_MODE_USR_THUMB;
#else
context->regPSR = PSR_MODE_USR_ARM;
context->regCPSR = PSR_MODE_USR_ARM;
#endif
context->R[0] = stack;
context->SP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
context->LR = 0;
context->R0 = stack;
context->USP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
context->ULR = 0;
context->PC = (UINTPTR)taskEntry;
}
VOID OsInitSignalContext(VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param)
{
IrqContext *newSp = (IrqContext *)signalContext;
(VOID)memcpy_s(signalContext, sizeof(IrqContext), sp, sizeof(IrqContext));
newSp->PC = sigHandler;
newSp->R0 = signo;
newSp->R1 = param;
}
DEPRECATED VOID Dmb(VOID)
{
__asm__ __volatile__ ("dmb" : : : "memory");

View File

@ -47,9 +47,10 @@
.extern OsDataAbortExcHandleEntry
#endif
#endif
.extern OsSaveSignalContext
.extern OsRestorSignalContext
.extern OsArmSharedPageFault
.extern OsArmA32SyscallHandle
.extern LOS_Exit
.global _osExceptFiqHdl
.global _osExceptAddrAbortHdl
@ -63,7 +64,6 @@
.global __stack_chk_guard_setup
#endif
.fpu vfpv4
.macro PUSH_FPU_REGS reg1
@ -173,69 +173,77 @@ _osExceptUndefInstrHdl:
#ifdef LOSCFG_GDB
GDB_HANDLE OsUndefIncExcHandleEntry
#else
@ LR offset to return from this exception: 0.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^ @ push user sp and lr
SUB SP, SP, #(2 * 4)
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_UNDEF_INSTR @ Set exception ID to OS_EXCEPT_UNDEF_INSTR.
B _osExceptDispatch @ Branch to global exception handler.
#endif
@ Description: Software interrupt exception handler
_osExceptSwiHdl:
SUB SP, SP, #(4 * 16)
STMIA SP, {R0-R12}
MRS R3, SPSR
MOV R4, LR
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(4 * 4) @ push user sp and lr and jump reserved field
STR R7, [SP, #0] @ Save system call number to reserved2 filed
#ifdef LOSCFG_KERNEL_SYSCALL
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
CMP R1, #CPSR_USER_MODE @ User mode
BNE OsKernelSVCHandler @ Branch if not user mode
LDR R3, [SP, #(11 * 4)]
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
CMP R1, #CPSR_USER_MODE @ User mode
BNE _osKernelSVCHandler @ Branch if not user mode
@ we enter from user mode, we need get the values of USER mode r13(sp) and r14(lr).
@ stmia with ^ will return the user mode registers (provided that r15 is not in the register list).
CMP R7, #119 @ __NR_sigreturn
BNE _osIsSyscall
MOV R0, SP
STMFD SP!, {R3} @ Save the CPSR
ADD R3, SP, #(4 * 17) @ Offset to pc/cpsr storage
STMFD R3!, {R4} @ Save the CPSR and r15(pc)
STMFD R3, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
SUB SP, SP, #4
BLX OsRestorSignalContext
MOV SP, R0
B _osSyscallReturn
_osIsSyscall:
STMFD SP!, {R4-R11}
PUSH_FPU_REGS R1
MOV FP, #0 @ Init frame pointer
MOV R0, SP
MOV FP, #0 @ Init frame pointer
CPSIE I
BLX OsArmA32SyscallHandle
CPSID I
POP_FPU_REGS R1
ADD SP, SP,#4
LDMFD SP!, {R3} @ Fetch the return SPSR
MSR SPSR_cxsf, R3 @ Set the return mode SPSR
LDMFD SP!, {R4-R11}
@ we are leaving to user mode, we need to restore the values of USER mode r13(sp) and r14(lr).
@ ldmia with ^ will return the user mode registers (provided that r15 is not in the register list)
MOV R0, SP
SUB SP, SP, #(12 * 4) @ sp - sizeof(IrqContext), reserved for signal
MOV R1, SP
BLX OsSaveSignalContext
MOV SP, R0
LDMFD SP!, {R0-R12}
_osSyscallReturn:
LDR R7, [SP, #0]
ADD SP, SP, #(2 * 4) @ jump reserved filed
LDMFD SP, {R13, R14}^ @ Restore user mode R13/R14
ADD SP, SP, #(2 * 4)
LDMFD SP!, {PC}^ @ Return to user
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP! @ Return to user
OsKernelSVCHandler:
_osKernelSVCHandler:
#endif
ADD R0, SP, #(4 * 16)
MOV R5, R0
STMFD R0!, {R4} @ Store PC
STMFD R0!, {R4}
STMFD R0!, {R5}
STMFD SP!, {R3} @ Push task`s CPSR (i.e. exception SPSR).
SUB SP, SP, #(4 * 2) @ user sp and lr
MOV R0, #0
STR R0, [SP, #0]
STR R0, [SP, #4]
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_SWI @ Set exception ID to OS_EXCEPT_SWI.
B _osExceptionSwi @ Branch to global exception handler.
B _osExceptDispatch @ Branch to global exception handler.
@ Description: Prefectch abort exception handler
_osExceptPrefetchAbortHdl:
@ -245,20 +253,37 @@ _osExceptPrefetchAbortHdl:
#endif
#else
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
MOV R5, LR
MRS R1, SPSR
MOV R0, #OS_EXCEPT_PREFETCH_ABORT @ Set exception ID to OS_EXCEPT_PREFETCH_ABORT.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
MRC P15, 0, R2, C6, C0, 2
MRC P15, 0, R3, C5, C0, 1
STMFD SP!, {R2-R3} @ Save far and fsr
STMFD SP!, {R4-R11}
#ifdef LOSCFG_KERNEL_VM
AND R4, R1, #CPSR_MASK_MODE @ Interrupted mode
CMP R4, #CPSR_USER_MODE @ User mode
BEQ _osExcPageFault @ Branch if user mode
LDR R0, [SP, #(19 * 4)]
AND R0, R0, #CPSR_MASK_MODE @ Interrupted mode
CMP R0, #CPSR_USER_MODE @ User mode
BNE _osKernelExceptPrefetchAbortHdl
MOV R1, SP
PUSH_FPU_REGS R0
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
BLX OsArmSharedPageFault
CMP R0, #0
POP_FPU_REGS R0
BEQ _osExcPageFaultReturn
#endif
_osKernelExceptPrefetchAbortHdl:
MOV LR, R5
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
B _osExceptDispatch @ Branch to global exception handler.
#endif
@ -270,120 +295,96 @@ _osExceptDataAbortHdl:
#endif
#else
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
MOV R5, LR
MRS R1, SPSR
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
MRC P15, 0, R2, C6, C0, 0
MRC P15, 0, R3, C5, C0, 0
STMFD SP!, {R2-R3} @ Save far and fsr
STMFD SP!, {R4-R11}
#ifdef LOSCFG_KERNEL_VM
B _osExcPageFault
#else
MOV R1, SP
PUSH_FPU_REGS R0
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
BLX OsArmSharedPageFault
CMP R0, #0
POP_FPU_REGS R0
BEQ _osExcPageFaultReturn
#endif
MOV R0, #OS_EXCEPT_DATA_ABORT
B _osExceptDispatch
#endif
#ifdef LOSCFG_KERNEL_VM
_osExcPageFaultReturn:
LDMFD SP!, {R4-R11}
ADD SP, SP, #(2 * 4)
LDMFD SP, {R13, R14}^
ADD SP, SP, #(2 * 4) @ Jump reserved fileds
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
#endif
@ Description: Address abort exception handler
_osExceptAddrAbortHdl:
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_ADDR_ABORT @ Set exception ID to OS_EXCEPT_ADDR_ABORT.
B _osExceptDispatch @ Branch to global exception handler.
@ Description: Fast interrupt request exception handler
_osExceptFiqHdl:
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
STMFD SP, {R0-R7} @ Push working registers.
MOV R0, #OS_EXCEPT_FIQ @ Set exception ID to OS_EXCEPT_FIQ.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
B _osExceptDispatch @ Branch to global exception handler.
#ifdef LOSCFG_KERNEL_VM
_osExcPageFault:
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
MOV R2, SP
STMFD SP!, {R5} @ Push original PC
STMFD SP!, {LR} @ Push original svc LR
STMFD SP!, {R2} @ Push original svc SP
STMFD SP!, {R8-R12} @ Push original R12-R8,
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
STMFD SP!, {R1}
SUB SP, SP, #8
STMIA SP, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
MOV R4, SP
BIC SP, SP, #7
PUSH_FPU_REGS R1
CMP R0, #OS_EXCEPT_DATA_ABORT
BNE 1f
MRC P15, 0, R2, C6, C0, 0
MRC P15, 0, R3, C5, C0, 0
B 2f
1: MRC P15, 0, R2, C6, C0, 2
MRC P15, 0, R3, C5, C0, 1
2: MOV R1, R4
MOV R5, R0
MOV R8, R2
MOV R9, R3
BLX OsArmSharedPageFault
POP_FPU_REGS R1
MOV SP, R4
CMP R0, #0
BEQ _OsExcReturn
MOV R0, R5 @ exc type
B _osExceptionSwi
#endif
@ Description: Exception handler
@ Parameter : R0 Exception Type
@ Regs Hold : R3 Exception`s CPSR
_osExceptDispatch:
MRS R2, SPSR @ Save CPSR before exception.
MOV R1, LR @ Save PC before exception.
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
LDR R8, [SP, #(8 * 4)] @ Get far
LDR R9, [SP, #(9 * 4)] @ Get fsr
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
MOV R5, SP
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
ADD R2, SP, #(20 * 4) @ sp + sizeof(ExcContext), position of SVC stack before exception
STR R2, [SP, #(8 * 4)] @ Save svc sp
STMFD SP!, {R1} @ Push Exception PC
STMFD SP!, {LR} @ Push SVC LR
STMFD SP!, {R5} @ Push SVC SP
STMFD SP!, {R8-R12} @ Push original R12-R8,
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
STMFD SP!, {R4-R11}
STMFD SP!, {R2} @ Push task`s CPSR (i.e. exception SPSR).
MOV R1, SP
CMP R0, #OS_EXCEPT_DATA_ABORT
BNE 1f
MRC P15, 0, R8, C6, C0, 0
MRC P15, 0, R9, C5, C0, 0
B 3f
1: CMP R0, #OS_EXCEPT_PREFETCH_ABORT
BNE 2f
MRC P15, 0, R8, C6, C0, 2
MRC P15, 0, R9, C5, C0, 1
B 3f
2: MOV R8, #0
MOV R9, #0
3: AND R2, R2, #CPSR_MASK_MODE
#ifdef LOSCFG_KERNEL_VM
LDR R2, [SP, #(19 * 4)] @ Get CPSR
AND R2, R2, #CPSR_MASK_MODE @ Interrupted mode
CMP R2, #CPSR_USER_MODE @ User mode
BNE 4f
STMFD SP, {R13, R14}^ @ save user mode sp and lr
4:
SUB SP, SP, #(4 * 2)
BEQ _osExceptionGetSP
#endif
_osExceptionSwi:
MOV R1, SP @ The second argument to the exception
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
MRC P15, 0, R4, C0, C0, 5
AND R4, R4, #MPIDR_CPUID_MASK @ Get Current cpu id
@ -412,19 +413,4 @@ _osExceptionGetSP:
LDR R5, =OsExcHandleEntry @ OsExcHandleEntry(UINT32 excType, ExcContext * excBufAddr)
BX R5
_OsExcReturn:
LDR R0, [SP, #(2 * 4)]
AND R0, R0, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE @ User mode
BNE _OsExcReturnToKernel
LDMFD SP, {R13, R14}^ @ load user mode sp and lr
_OsExcReturnToKernel:
ADD SP, SP, #(2 * 4)
LDMFD SP!, {R1}
MSR SPSR_cxsf, R1 @ Set the return mode SPSR
LDMFD SP!, {R0-R12}
ADD SP, SP, #4
LDMFD SP!, {LR, PC}^
.end

View File

@ -37,17 +37,9 @@
.global __exc_stack_top
.global __irq_stack_top
.global __fiq_stack_top
.global __svc_stack_top
.global __abt_stack_top
.global __undef_stack_top
.global __exc_stack
.global __irq_stack
.global __fiq_stack
.global __svc_stack
.global __abt_stack
.global __undef_stack
.extern __bss_start
.extern __bss_end
@ -219,35 +211,14 @@ reloc_img_to_bottom_done:
bl mmu_setup /* set up the mmu */
#endif
/* clear out the interrupt and exception stack and set magic num to check the overflow */
ldr r0, =__undef_stack
ldr r0, =__svc_stack
ldr r1, =__exc_stack_top
bl stack_init
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
warm_reset:
/* initialize interrupt/exception environments */
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
msr cpsr, r0
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
msr cpsr, r0
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
msr cpsr, r0
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
msr cpsr, r0
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
/* initialize CPSR (machine state register) */
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
msr cpsr, r0
@ -498,22 +469,6 @@ init_flag:
.section ".int_stack", "wa", %nobits
.align 3
__undef_stack:
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
__undef_stack_top:
__abt_stack:
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
__abt_stack_top:
__irq_stack:
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
__irq_stack_top:
__fiq_stack:
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
__fiq_stack_top:
__svc_stack:
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
__svc_stack_top:

View File

@ -38,17 +38,9 @@
.global __exc_stack_top
.global __irq_stack_top
.global __fiq_stack_top
.global __svc_stack_top
.global __abt_stack_top
.global __undef_stack_top
.global __exc_stack
.global __irq_stack
.global __fiq_stack
.global __svc_stack
.global __abt_stack
.global __undef_stack
.extern __bss_start
.extern __bss_end
@ -201,36 +193,15 @@ reloc_img_to_bottom_done:
excstatck_loop:
/* clear out the interrupt and exception stack and set magic num to check the overflow */
ldr r0, =__undef_stack
ldr r0, =__svc_stack
ldr r1, =__exc_stack_top
bl stack_init
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
excstatck_loop_done:
warm_reset:
/* initialize interrupt/exception environments */
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
msr cpsr, r0
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
msr cpsr, r0
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
msr cpsr, r0
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
msr cpsr, r0
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
/* initialize CPSR (machine state register) */
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
msr cpsr, r0
@ -464,22 +435,6 @@ init_flag:
.section ".int_stack", "wa", %nobits
.align 3
__undef_stack:
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
__undef_stack_top:
__abt_stack:
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
__abt_stack_top:
__irq_stack:
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
__irq_stack_top:
__fiq_stack:
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
__fiq_stack_top:
__svc_stack:
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
__svc_stack_top:

View File

@ -63,26 +63,29 @@ typedef struct {
UINT64 SPSR;
} ExcContext;
#else
/* It has the same structure as TaskContext */
typedef struct {
UINT32 USP; /**< User mode stack pointer */
UINT32 ULR; /**< User mode program returning address */
UINT32 regCPSR; /**< Current program status register (CPSR) */
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
UINT32 SP; /**< svc sp */
UINT32 reserved; /**< Reserved, multiplexing register */
UINT32 USP;
UINT32 ULR;
UINT32 R0; /**< Register R0 */
UINT32 R1; /**< Register R1 */
UINT32 R2; /**< Register R2 */
UINT32 R3; /**< Register R3 */
UINT32 R4; /**< Register R4 */
UINT32 R5; /**< Register R5 */
UINT32 R6; /**< Register R6 */
UINT32 R7; /**< Register R7 */
UINT32 R8; /**< Register R8 */
UINT32 R9; /**< Register R9 */
UINT32 R10; /**< Register R10 */
UINT32 R11; /**< Register R11 */
UINT32 R12; /**< Register R12 */
UINT32 SP; /**< Stack pointer */
UINT32 LR; /**< Program returning address. */
UINT32 PC; /**< PC pointer of the exceptional function */
UINT32 regCPSR;
} ExcContext;
#endif

View File

@ -44,19 +44,11 @@ extern "C" {
extern UINTPTR __stack_startup;
extern UINTPTR __stack_startup_top;
#else
extern UINTPTR __fiq_stack_top;
extern UINTPTR __svc_stack_top;
extern UINTPTR __abt_stack_top;
extern UINTPTR __undef_stack_top;
extern UINTPTR __exc_stack_top;
extern UINTPTR __fiq_stack;
extern UINTPTR __svc_stack;
extern UINTPTR __abt_stack;
extern UINTPTR __undef_stack;
extern UINTPTR __exc_stack;
#endif
extern UINTPTR __irq_stack_top;
extern UINTPTR __irq_stack;
#ifdef __cplusplus
#if __cplusplus

View File

@ -739,11 +739,8 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
mqueueCB = privateMqPersonal->mq_posixdes;
OS_MQ_GOTO_ERROUT_UNLOCK_IF(msgLen > (size_t)(mqueueCB->mqcb->queueSize - sizeof(UINT32)), EMSGSIZE);
@ -786,10 +783,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
if (privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC) {
errno = EBADF;
goto ERROUT_UNLOCK;
}

View File

@ -49,16 +49,19 @@ typedef enum {
} QuickstartStage;
typedef enum {
QS_UNREGISTER = QS_STAGE_LIMIT, /* quickstart dev unregister */
QS_NOTIFY, /* quickstart notify */
QS_LISTEN, /* quickstart listen */
QS_NOTIFY = QS_STAGE_LIMIT, /* quickstart notify */
QS_LISTEN, /* quickstart listen */
QS_CTL_LIMIT
} QuickstartConctrl;
typedef struct {
unsigned int events;
unsigned int wait;
} QuickstartListenArgs;
#define QUICKSTART_IOC_MAGIC 'T'
#define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, QS_UNREGISTER)
#define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY)
#define QUICKSTART_LISTEN _IO(QUICKSTART_IOC_MAGIC, QS_LISTEN)
#define QUICKSTART_LISTEN _IOR(QUICKSTART_IOC_MAGIC, QS_LISTEN, QuickstartListenArgs)
#define QUICKSTART_STAGE(x) _IO(QUICKSTART_IOC_MAGIC, (x))
#define QUICKSTART_NODE "/dev/quickstart"

View File

@ -33,7 +33,7 @@
#include "fcntl.h"
#include "linux/kernel.h"
#include "los_process_pri.h"
#include "fs/fs.h"
EVENT_CB_S g_qsEvent;
static SysteminitHook g_systemInitFunc[QS_STAGE_CNT] = {0};
@ -49,14 +49,35 @@ static int QuickstartClose(struct file *filep)
return 0;
}
static void QuickstartNotify(unsigned int events)
static int QuickstartNotify(unsigned int events)
{
LOS_EventWrite((PEVENT_CB_S)&g_qsEvent, events);
int ret = LOS_EventWrite((PEVENT_CB_S)&g_qsEvent, events);
if (ret != 0) {
PRINT_ERR("%s,%d:0x%x\n", __FUNCTION__, __LINE__, ret);
ret = -EINVAL;
}
return ret;
}
static void QuickstartListen(unsigned int eventMask)
#define WAITLIMIT 300000 /* 5min = 5*60*1000*1tick(1ms) */
static int QuickstartListen(unsigned long arg)
{
LOS_EventRead((PEVENT_CB_S)&g_qsEvent, eventMask, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
QuickstartListenArgs args;
if (copy_from_user(&args, (QuickstartListenArgs __user *)arg, sizeof(QuickstartListenArgs)) != LOS_OK) {
PRINT_ERR("%s,%d,failed!\n", __FUNCTION__, __LINE__);
return -EINVAL;
}
if (args.wait > WAITLIMIT) {
args.wait = WAITLIMIT;
PRINT_ERR("%s wait arg is too longer, set to WAITLIMIT!\n", __FUNCTION__);
}
int ret = LOS_EventRead((PEVENT_CB_S)&g_qsEvent, args.events, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, args.wait);
if (ret != args.events && ret != 0) { /* 0: nowait is normal case */
PRINT_ERR("%s,%d:0x%x\n", __FUNCTION__, __LINE__, ret);
ret = -EINVAL;
}
return ret;
}
void QuickstartHookRegister(LosSysteminitHook hooks)
@ -66,7 +87,7 @@ void QuickstartHookRegister(LosSysteminitHook hooks)
}
}
static void QuickstartStageWorking(unsigned int level)
static int QuickstartStageWorking(unsigned int level)
{
if ((level < QS_STAGE_CNT) && (g_callOnce[level] == 0) && (g_systemInitFunc[level] != NULL)) {
g_callOnce[level] = 1; /* 1: Already called */
@ -74,55 +95,47 @@ static void QuickstartStageWorking(unsigned int level)
} else {
PRINT_WARN("Trigger quickstart,but doing nothing!!\n");
}
return 0;
}
static int QuickstartDevUnregister(void)
static int QuickstartDevUnlink(struct Vnode *node)
{
(void)node;
return unregister_driver(QUICKSTART_NODE);
}
static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg)
{
ssize_t ret;
if (cmd == QUICKSTART_NOTIFY) {
QuickstartNotify(arg);
return 0;
return QuickstartNotify(arg);
}
if (OsGetUserInitProcessID() != LOS_GetCurrProcessID()) {
PRINT_ERR("Permission denios!\n");
return -1;
return -EACCES;
}
switch (cmd) {
case QUICKSTART_UNREGISTER:
QuickstartDevUnregister();
break;
case QUICKSTART_LISTEN:
QuickstartListen(arg);
ret = QuickstartListen(arg);
break;
default:
QuickstartStageWorking(cmd - QUICKSTART_STAGE(QS_STAGE1)); /* ioctl cmd converted to stage level */
ret = QuickstartStageWorking(cmd - QUICKSTART_STAGE(QS_STAGE1)); /* ioctl cmd converted to stage level */
break;
}
return 0;
return ret;
}
static const struct file_operations_vfs g_quickstartDevOps = {
QuickstartOpen, /* open */
QuickstartClose, /* close */
NULL, /* read */
NULL, /* write */
NULL, /* seek */
QuickstartIoctl, /* ioctl */
NULL, /* mmap */
#ifndef CONFIG_DISABLE_POLL
NULL, /* poll */
#endif
NULL, /* unlink */
.open = QuickstartOpen, /* open */
.close = QuickstartClose, /* close */
.ioctl = QuickstartIoctl, /* ioctl */
.unlink = QuickstartDevUnlink, /* unlink */
};
int QuickstartDevRegister(void)
{
LOS_EventInit(&g_qsEvent);
return register_driver(QUICKSTART_NODE, &g_quickstartDevOps, 0666, 0); /* 0666: file mode */
return register_driver(QUICKSTART_NODE, &g_quickstartDevOps, 0644, 0); /* 0644: file mode */
}

View File

@ -1141,6 +1141,9 @@ int fatfs_umount(struct Mount *mnt, struct Vnode **blkdriver)
int fatfs_statfs(struct Mount *mnt, struct statfs *info)
{
FATFS *fs = (FATFS *)mnt->data;
DWORD nclst = 0;
FRESULT result = FR_OK;
int ret;
info->f_type = MSDOS_SUPER_MAGIC;
#if FF_MAX_SS != FF_MIN_SS
@ -1149,8 +1152,17 @@ int fatfs_statfs(struct Mount *mnt, struct statfs *info)
info->f_bsize = FF_MIN_SS * fs->csize;
#endif
info->f_blocks = fs->n_fatent;
ret = lock_fs(fs);
if (ret == FALSE) {
return -EBUSY;
}
/* free cluster is unavailable, update it */
if (fs->free_clst == DISK_ERROR) {
result = fat_count_free_entries(&nclst, fs);
}
info->f_bfree = fs->free_clst;
info->f_bavail = fs->free_clst;
unlock_fs(fs, result);
#if FF_USE_LFN
/* Maximum length of filenames */
@ -1166,7 +1178,7 @@ int fatfs_statfs(struct Mount *mnt, struct statfs *info)
info->f_ffree = 0;
info->f_flags = mnt->mountFlags;
return 0;
return -fatfs_2_vfs(result);
}
static inline int GET_SECONDS(WORD ftime)

View File

@ -64,6 +64,8 @@ typedef struct ProcessCB LosProcessCB;
void files_refer(int fd);
int files_close_internal(int fd, LosProcessCB *processCB);
struct files_struct *dup_fd(struct files_struct *oldf);
struct files_struct *alloc_files(void);

View File

@ -121,5 +121,6 @@ void ChangeRoot(struct Vnode *newRoot);
BOOL VnodeInUseIter(const struct Mount *mount);
struct Vnode *VnodeGetRoot(void);
void VnodeMemoryDump(void);
int VnodeDestory(struct Vnode *vnode);
#endif /* !_VNODE_H_ */

View File

@ -54,4 +54,8 @@ int CheckProcessFd(int procFd);
void FreeProcessFd(int procFd);
int CopyFdToProc(int fd, unsigned int targetPid);
int CloseProcFd(int fd, unsigned int targetPid);
#endif

View File

@ -34,6 +34,10 @@
#include "fs/fd_table.h"
#include "fs/file.h"
#include "fs/fs.h"
#include "mqueue.h"
#ifdef LOSCFG_NET_LWIP_SACK
#include "lwip/sockets.h"
#endif
static void FileTableLock(struct fd_table_s *fdt)
{
@ -247,7 +251,7 @@ int AllocLowestProcessFd(int minFd)
return VFS_ERROR;
}
// occupy the fd set
/* occupy the fd set */
FD_SET(procFd, fdt->proc_fds);
FileTableUnLock(fdt);
@ -275,7 +279,7 @@ int AllocAndAssocProcessFd(int sysFd, int minFd)
return VFS_ERROR;
}
// occupy the fd set
/* occupy the fd set */
FD_SET(procFd, fdt->proc_fds);
fdt->ft_fds[procFd].sysFd = sysFd;
FileTableUnLock(fdt);
@ -303,3 +307,174 @@ int AllocAndAssocSystemFd(int procFd, int minFd)
return sysFd;
}
static void FdRefer(int sysFd)
{
if ((sysFd > STDERR_FILENO) && (sysFd < CONFIG_NFILE_DESCRIPTORS)) {
files_refer(sysFd);
}
#if defined(LOSCFG_NET_LWIP_SACK)
if ((sysFd >= CONFIG_NFILE_DESCRIPTORS) && (sysFd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))) {
socks_refer(sysFd);
}
#endif
#if defined(LOSCFG_COMPAT_POSIX)
if ((sysFd >= MQUEUE_FD_OFFSET) && (sysFd < (MQUEUE_FD_OFFSET + CONFIG_NQUEUE_DESCRIPTORS))) {
mqueue_refer(sysFd);
}
#endif
}
static void FdClose(int sysFd, unsigned int targetPid)
{
UINT32 intSave;
if ((sysFd > STDERR_FILENO) && (sysFd < CONFIG_NFILE_DESCRIPTORS)) {
LosProcessCB *processCB = OS_PCB_FROM_PID(targetPid);
SCHEDULER_LOCK(intSave);
if (OsProcessIsInactive(processCB)) {
SCHEDULER_UNLOCK(intSave);
return;
}
SCHEDULER_UNLOCK(intSave);
files_close_internal(sysFd, processCB);
}
#if defined(LOSCFG_NET_LWIP_SACK)
if ((sysFd >= CONFIG_NFILE_DESCRIPTORS) && (sysFd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))) {
socks_close(sysFd);
}
#endif
#if defined(LOSCFG_COMPAT_POSIX)
if ((sysFd >= MQUEUE_FD_OFFSET) && (sysFd < (MQUEUE_FD_OFFSET + CONFIG_NQUEUE_DESCRIPTORS))) {
mq_close((mqd_t)sysFd);
}
#endif
}
static struct fd_table_s *GetProcessFTable(unsigned int pid, sem_t *semId)
{
UINT32 intSave;
struct files_struct *procFiles = NULL;
LosProcessCB *processCB = OS_PCB_FROM_PID(pid);
SCHEDULER_LOCK(intSave);
if (OsProcessIsInactive(processCB)) {
SCHEDULER_UNLOCK(intSave);
return NULL;
}
procFiles = processCB->files;
if (procFiles == NULL || procFiles->fdt == NULL) {
SCHEDULER_UNLOCK(intSave);
return NULL;
}
*semId = procFiles->fdt->ft_sem;
SCHEDULER_UNLOCK(intSave);
return procFiles->fdt;
}
int CopyFdToProc(int fd, unsigned int targetPid)
{
#if !defined(LOSCFG_NET_LWIP_SACK) && !defined(LOSCFG_COMPAT_POSIX) && !defined(LOSCFG_FS_VFS)
return -ENOSYS;
#else
int sysFd;
struct fd_table_s *fdt = NULL;
int procFd;
sem_t semId;
if (OS_PID_CHECK_INVALID(targetPid)) {
return -EINVAL;
}
sysFd = GetAssociatedSystemFd(fd);
if (sysFd < 0) {
return -EBADF;
}
FdRefer(sysFd);
fdt = GetProcessFTable(targetPid, &semId);
if (fdt == NULL || fdt->ft_fds == NULL) {
FdClose(sysFd, targetPid);
return -EPERM;
}
/* Take the semaphore (perhaps waiting) */
if (sem_wait(&semId) != 0) {
/* Target process changed */
FdClose(sysFd, targetPid);
return -ESRCH;
}
procFd = AssignProcessFd(fdt, 3);
if (procFd < 0) {
if (sem_post(&semId) == -1) {
PRINT_ERR("sem_post error, errno %d \n", get_errno());
}
FdClose(sysFd, targetPid);
return -EPERM;
}
/* occupy the fd set */
FD_SET(procFd, fdt->proc_fds);
fdt->ft_fds[procFd].sysFd = sysFd;
if (sem_post(&semId) == -1) {
PRINTK("sem_post error, errno %d \n", get_errno());
}
return procFd;
#endif
}
int CloseProcFd(int procFd, unsigned int targetPid)
{
#if !defined(LOSCFG_NET_LWIP_SACK) && !defined(LOSCFG_COMPAT_POSIX) && !defined(LOSCFG_FS_VFS)
return -ENOSYS;
#else
int sysFd;
struct fd_table_s *fdt = NULL;
sem_t semId;
if (OS_PID_CHECK_INVALID(targetPid)) {
return -EINVAL;
}
fdt = GetProcessFTable(targetPid, &semId);
if (fdt == NULL || fdt->ft_fds == NULL) {
return -EPERM;
}
/* Take the semaphore (perhaps waiting) */
if (sem_wait(&semId) != 0) {
/* Target process changed */
return -ESRCH;
}
if (!IsValidProcessFd(fdt, procFd)) {
if (sem_post(&semId) == -1) {
PRINTK("sem_post error, errno %d \n", get_errno());
}
return -EPERM;
}
sysFd = fdt->ft_fds[procFd].sysFd;
if (sysFd < 0) {
if (sem_post(&semId) == -1) {
PRINTK("sem_post error, errno %d \n", get_errno());
}
return -EPERM;
}
/* clean the fd set */
FD_CLR(procFd, fdt->proc_fds);
fdt->ft_fds[procFd].sysFd = -1;
if (sem_post(&semId) == -1) {
PRINTK("sem_post error, errno %d \n", get_errno());
}
FdClose(sysFd, targetPid);
return 0;
#endif
}

View File

@ -837,6 +837,10 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
return remove(pathname);
}
d = opendir(pathname);
if (d == NULL)
{
return -1;
}
while (1)
{
dirent = readdir(d);

View File

@ -168,29 +168,21 @@ int VnodeFree(struct Vnode *vnode)
if (vnode == NULL) {
return LOS_OK;
}
struct PathCache *item = NULL;
struct PathCache *nextItem = NULL;
VnodeHold();
if (vnode->useCount > 0) {
VnodeDrop();
return -EBUSY;
}
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
PathCacheFree(item);
}
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->parentPathCaches, struct PathCache, parentEntry) {
PathCacheFree(item);
}
VnodePathCacheFree(vnode);
LOS_ListDelete(&(vnode->hashEntry));
LOS_ListDelete(&vnode->actFreeEntry);
if (vnode->vop->Reclaim) {
vnode->vop->Reclaim(vnode);
}
LOS_ListDelete(&vnode->actFreeEntry);
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);
@ -629,4 +621,28 @@ void VnodeMemoryDump(void)
PRINTK("Vnode number = %d\n", vnodeCount);
PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode));
}
}
int VnodeDestory(struct Vnode *vnode)
{
if (vnode == NULL || vnode->vop != &g_devfsOps) {
/* destory only support dev vnode */
return -EINVAL;
}
VnodeHold();
if (vnode->useCount > 0) {
VnodeDrop();
return -EBUSY;
}
VnodePathCacheFree(vnode);
LOS_ListDelete(&(vnode->hashEntry));
LOS_ListDelete(&vnode->actFreeEntry);
free(vnode->data);
free(vnode);
VnodeDrop();
return LOS_OK;
}

View File

@ -1349,8 +1349,6 @@ LITE_OS_SEC_TEXT UINT32 OsExecRecycleAndInit(LosProcessCB *processCB, const CHAR
LITE_OS_SEC_TEXT UINT32 OsExecStart(const TSK_ENTRY_FUNC entry, UINTPTR sp, UINTPTR mapBase, UINT32 mapSize)
{
LosTaskCB *taskCB = NULL;
TaskContext *taskContext = NULL;
UINT32 intSave;
if (entry == NULL) {
@ -1365,15 +1363,16 @@ LITE_OS_SEC_TEXT UINT32 OsExecStart(const TSK_ENTRY_FUNC entry, UINTPTR sp, UINT
return LOS_NOK;
}
SCHEDULER_LOCK(intSave);
taskCB = OsCurrTaskGet();
LosTaskCB *taskCB = OsCurrTaskGet();
SCHEDULER_LOCK(intSave);
taskCB->userMapBase = mapBase;
taskCB->userMapSize = mapSize;
taskCB->taskEntry = (TSK_ENTRY_FUNC)entry;
taskContext = (TaskContext *)OsTaskStackInit(taskCB->taskID, taskCB->stackSize, (VOID *)taskCB->topOfStack, FALSE);
OsUserTaskStackInit(taskContext, taskCB->taskEntry, sp);
TaskContext *taskContext = (TaskContext *)OsTaskStackInit(taskCB->taskID, taskCB->stackSize,
(VOID *)taskCB->topOfStack, FALSE);
OsUserTaskStackInit(taskContext, (UINTPTR)taskCB->taskEntry, sp);
SCHEDULER_UNLOCK(intSave);
return LOS_OK;
}
@ -1555,7 +1554,7 @@ STATIC VOID OsInitCopyTaskParam(LosProcessCB *childProcessCB, const CHAR *name,
STATIC UINT32 OsCopyTask(UINT32 flags, LosProcessCB *childProcessCB, const CHAR *name, UINTPTR entry, UINT32 size)
{
LosTaskCB *childTaskCB = NULL;
LosTaskCB *runTask = OsCurrTaskGet();
TSK_INIT_PARAM_S childPara = { 0 };
UINT32 ret;
UINT32 intSave;
@ -1571,8 +1570,8 @@ STATIC UINT32 OsCopyTask(UINT32 flags, LosProcessCB *childProcessCB, const CHAR
return LOS_ENOMEM;
}
childTaskCB = OS_TCB_FROM_TID(taskID);
childTaskCB->taskStatus = OsCurrTaskGet()->taskStatus;
LosTaskCB *childTaskCB = OS_TCB_FROM_TID(taskID);
childTaskCB->taskStatus = runTask->taskStatus;
if (childTaskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
childTaskCB->taskStatus &= ~OS_TASK_STATUS_RUNNING;
} else {
@ -1585,7 +1584,7 @@ STATIC UINT32 OsCopyTask(UINT32 flags, LosProcessCB *childProcessCB, const CHAR
if (OsProcessIsUserMode(childProcessCB)) {
SCHEDULER_LOCK(intSave);
OsUserCloneParentStack(childTaskCB, OsCurrTaskGet());
OsUserCloneParentStack(childTaskCB->stackPointer, runTask->topOfStack, runTask->stackSize);
SCHEDULER_UNLOCK(intSave);
}
return LOS_OK;

View File

@ -55,10 +55,14 @@ STATIC INLINE VOID OsAddNode2SortLink(SortLinkAttribute *sortLinkHeader, SortLin
}
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(head->pstNext, SortLinkList, sortLinkNode);
if (listSorted->responseTime >= sortList->responseTime) {
if (listSorted->responseTime > sortList->responseTime) {
LOS_ListAdd(head, &sortList->sortLinkNode);
sortLinkHeader->nodeNum++;
return;
} else if (listSorted->responseTime == sortList->responseTime) {
LOS_ListAdd(head->pstNext, &sortList->sortLinkNode);
sortLinkHeader->nodeNum++;
return;
}
LOS_DL_LIST *prevNode = head->pstPrev;

View File

@ -240,7 +240,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID)
ret = LOS_TaskCreateOnly(idleTaskID, &taskInitParam);
LosTaskCB *idleTask = OS_TCB_FROM_TID(*idleTaskID);
idleTask->taskStatus |= OS_TASK_FLAG_SYSTEM_TASK;
OsSchedSetIdleTaskSchedPartam(idleTask);
OsSchedSetIdleTaskSchedParam(idleTask);
return ret;
}
@ -571,7 +571,7 @@ STATIC UINT32 OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT_PARAM_S *initParam,
taskCB->userArea = initParam->userParam.userArea;
taskCB->userMapBase = initParam->userParam.userMapBase;
taskCB->userMapSize = initParam->userParam.userMapSize;
OsUserTaskStackInit(taskCB->stackPointer, taskCB->taskEntry, initParam->userParam.userSP);
OsUserTaskStackInit(taskCB->stackPointer, (UINTPTR)taskCB->taskEntry, initParam->userParam.userSP);
}
if (!processCB->threadNumber) {

View File

@ -152,7 +152,7 @@ STATIC INLINE VOID OsCpuSchedUnlock(Percpu *cpu, UINT32 intSave)
extern UINT32 OsSchedSetTickTimerType(UINT32 timerType);
extern VOID OsSchedSetIdleTaskSchedPartam(LosTaskCB *idleTask);
extern VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask);
extern UINT32 OsSchedSwtmrScanRegister(SchedScan func);

View File

@ -48,9 +48,6 @@ extern "C" {
#define LOS_BIT_CLR(val, bit) ((val) = (val) & ~(1ULL << (UINT32)(bit)))
#define LOS_IS_BIT_SET(val, bit) (bool)((((val) >> (UINT32)(bit)) & 1ULL))
#define OS_SYSCALL_SET_CPSR(regs, cpsr) (*((unsigned long *)((UINTPTR)(regs) - 4)) = (cpsr))
#define OS_SYSCALL_SET_SR(regs, cpsr) (*((unsigned long *)((UINTPTR)(regs))) = (cpsr))
#define OS_SYSCALL_GET_CPSR(regs) (*((unsigned long *)((UINTPTR)(regs) - 4)))
#define SIG_STOP_VISIT 1
#define OS_KERNEL_KILL_PERMISSION 0U
@ -135,27 +132,6 @@ struct sq_queue_s {
};
typedef struct sq_queue_s sq_queue_t;
#define TASK_IRQ_CONTEXT \
unsigned int R0; \
unsigned int R1; \
unsigned int R2; \
unsigned int R3; \
unsigned int R12; \
unsigned int USP; \
unsigned int ULR; \
unsigned int CPSR; \
unsigned int PC;
typedef struct {
TASK_IRQ_CONTEXT
} TaskIrqDataSize;
typedef struct {
TASK_IRQ_CONTEXT
unsigned int R7;
unsigned int count;
} sig_switch_context;
typedef struct {
sigset_t sigFlag;
sigset_t sigPendFlag;
@ -164,7 +140,8 @@ typedef struct {
LOS_DL_LIST waitList;
sigset_t sigwaitmask; /* Waiting for pending signals */
siginfo_t sigunbinfo; /* Signal info when task unblocked */
sig_switch_context context;
void *sigContext;
unsigned int count;
} sig_cb;
#define SIGEV_THREAD_ID 4
@ -180,8 +157,6 @@ int OsPthreadKill(UINT32 tid, int signo);
int OsSigEmptySet(sigset_t *);
int OsSigAddSet(sigset_t *, int);
int OsSigIsMember(const sigset_t *, int);
void OsSaveSignalContext(unsigned int *sp);
void OsRestorSignalContext(unsigned int *sp);
int OsKill(pid_t pid, int sig, int permission);
int OsDispatch(pid_t pid, siginfo_t *info, int permission);
int OsSigTimedWait(sigset_t *set, siginfo_t *info, unsigned int timeout);

View File

@ -296,7 +296,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_EventDestroy(PEVENT_CB_S eventCB)
return LOS_OK;
}
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 events)
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 eventMask)
{
UINT32 intSave;
@ -304,7 +304,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 events)
return LOS_ERRNO_EVENT_PTR_NULL;
}
SCHEDULER_LOCK(intSave);
eventCB->uwEventID &= events;
eventCB->uwEventID &= eventMask;
SCHEDULER_UNLOCK(intSave);
return LOS_OK;

View File

@ -556,131 +556,65 @@ int OsSigAction(int sig, const sigaction_t *act, sigaction_t *oact)
return LOS_OK;
}
void OsSaveSignalContext(unsigned int *sp)
VOID *OsSaveSignalContext(VOID *sp, VOID *newSp)
{
UINTPTR sigHandler;
UINT32 intSave;
LosTaskCB *task = NULL;
LosProcessCB *process = NULL;
sig_cb *sigcb = NULL;
unsigned long cpsr;
OS_RETURN_IF_VOID(sp == NULL);
cpsr = OS_SYSCALL_GET_CPSR(sp);
LosTaskCB *task = OsCurrTaskGet();
LosProcessCB *process = OsCurrProcessGet();
sig_cb *sigcb = &task->sig;
OS_RETURN_IF_VOID(((cpsr & CPSR_MASK_MODE) != CPSR_USER_MODE));
SCHEDULER_LOCK(intSave);
task = OsCurrTaskGet();
process = OsCurrProcessGet();
sigcb = &task->sig;
if ((sigcb->context.count == 0) && ((sigcb->sigFlag != 0) || (process->sigShare != 0))) {
if ((sigcb->count == 0) && ((sigcb->sigFlag != 0) || (process->sigShare != 0))) {
sigHandler = OsGetSigHandler();
if (sigHandler == 0) {
sigcb->sigFlag = 0;
process->sigShare = 0;
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("The signal processing function for the current process pid =%d is NULL!\n", task->processID);
return;
return sp;
}
/* One pthread do the share signal */
sigcb->sigFlag |= process->sigShare;
unsigned int signo = (unsigned int)FindFirstSetedBit(sigcb->sigFlag) + 1;
UINT32 signo = (UINT32)FindFirstSetedBit(sigcb->sigFlag) + 1;
UINT32 sigVal = (UINT32)(UINTPTR)(sigcb->sigunbinfo.si_value.sival_ptr);
OsProcessExitCodeSignalSet(process, signo);
sigcb->context.CPSR = cpsr;
sigcb->context.PC = sp[REG_PC];
sigcb->context.USP = sp[REG_SP];
sigcb->context.ULR = sp[REG_LR];
sigcb->context.R0 = sp[REG_R0];
sigcb->context.R1 = sp[REG_R1];
sigcb->context.R2 = sp[REG_R2];
sigcb->context.R3 = sp[REG_R3];
sigcb->context.R7 = sp[REG_R7];
sigcb->context.R12 = sp[REG_R12];
sp[REG_PC] = sigHandler;
sp[REG_R0] = signo;
sp[REG_R1] = (unsigned int)(UINTPTR)(sigcb->sigunbinfo.si_value.sival_ptr);
sigcb->sigContext = sp;
OsInitSignalContext(sp, newSp, sigHandler, signo, sigVal);
/* sig No bits 00000100 present sig No 3, but 1<< 3 = 00001000, so signo needs minus 1 */
sigcb->sigFlag ^= 1ULL << (signo - 1);
sigcb->context.count++;
}
SCHEDULER_UNLOCK(intSave);
}
void OsSaveSignalContextIrq(unsigned int *sp, unsigned int r7)
{
UINTPTR sigHandler;
LosTaskCB *task = NULL;
LosProcessCB *process = NULL;
sig_cb *sigcb = NULL;
unsigned long cpsr;
UINT32 intSave;
TaskIrqContext *context = (TaskIrqContext *)(sp);
OS_RETURN_IF_VOID(sp == NULL);
cpsr = context->CPSR;
OS_RETURN_IF_VOID(((cpsr & CPSR_MASK_MODE) != CPSR_USER_MODE));
SCHEDULER_LOCK(intSave);
task = OsCurrTaskGet();
process = OsCurrProcessGet();
sigcb = &task->sig;
if ((sigcb->context.count == 0) && ((sigcb->sigFlag != 0) || (process->sigShare != 0))) {
sigHandler = OsGetSigHandler();
if (sigHandler == 0) {
sigcb->sigFlag = 0;
process->sigShare = 0;
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("The current process pid =%d starts fail!\n", task->processID);
return;
}
sigcb->sigFlag |= process->sigShare;
unsigned int signo = (unsigned int)FindFirstSetedBit(sigcb->sigFlag) + 1;
OsProcessExitCodeSignalSet(process, signo);
(VOID)memcpy_s(&sigcb->context.R0, sizeof(TaskIrqDataSize), &context->R0, sizeof(TaskIrqDataSize));
sigcb->context.R7 = r7;
context->PC = sigHandler;
context->R0 = signo;
context->R1 = (UINT32)(UINTPTR)sigcb->sigunbinfo.si_value.sival_ptr;
/* sig No bits 00000100 present sig No 3, but 1<< 3 = 00001000, so signo needs minus 1 */
sigcb->sigFlag ^= 1ULL << (signo - 1);
sigcb->context.count++;
}
SCHEDULER_UNLOCK(intSave);
}
void OsRestorSignalContext(unsigned int *sp)
{
LosTaskCB *task = NULL; /* Do not adjust this statement */
LosProcessCB *process = NULL;
sig_cb *sigcb = NULL;
UINT32 intSave;
SCHEDULER_LOCK(intSave);
task = OsCurrTaskGet();
sigcb = &task->sig;
if (sigcb->context.count != 1) {
sigcb->count++;
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("sig error count : %d\n", sigcb->context.count);
return;
return newSp;
}
process = OsCurrProcessGet();
sp[REG_PC] = sigcb->context.PC;
OS_SYSCALL_SET_CPSR(sp, sigcb->context.CPSR);
sp[REG_SP] = sigcb->context.USP;
sp[REG_LR] = sigcb->context.ULR;
sp[REG_R0] = sigcb->context.R0;
sp[REG_R1] = sigcb->context.R1;
sp[REG_R2] = sigcb->context.R2;
sp[REG_R3] = sigcb->context.R3;
sp[REG_R7] = sigcb->context.R7;
sp[REG_R12] = sigcb->context.R12;
sigcb->context.count--;
SCHEDULER_UNLOCK(intSave);
return sp;
}
VOID *OsRestorSignalContext(VOID *sp)
{
UINT32 intSave;
LosTaskCB *task = OsCurrTaskGet();
sig_cb *sigcb = &task->sig;
SCHEDULER_LOCK(intSave);
if (sigcb->count != 1) {
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("sig error count : %d\n", sigcb->count);
return sp;
}
LosProcessCB *process = OsCurrProcessGet();
VOID *saveContext = sigcb->sigContext;
sigcb->count--;
process->sigShare = 0;
OsProcessExitCodeSignalClear(process);
SCHEDULER_UNLOCK(intSave);
return saveContext;
}

View File

@ -94,10 +94,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_MemboxInit(VOID *pool, UINT32 poolSize, UINT32
MEMBOX_LOCK(intSave);
boxInfo->uwBlkSize = LOS_MEMBOX_ALLIGNED(blkSize + OS_MEMBOX_NODE_HEAD_SIZE);
if (boxInfo->uwBlkSize == 0) {
MEMBOX_UNLOCK(intSave);
return LOS_NOK;
}
boxInfo->uwBlkNum = (poolSize - sizeof(LOS_MEMBOX_INFO)) / boxInfo->uwBlkSize;
boxInfo->uwBlkCnt = 0;
if (boxInfo->uwBlkNum == 0) {

View File

@ -919,10 +919,6 @@ STATIC INLINE VOID *OsMemAlloc(struct OsMemPoolHead *pool, UINT32 size, UINT32 i
#endif
UINT32 allocSize = OS_MEM_ALIGN(size + OS_MEM_NODE_HEAD_SIZE, OS_MEM_ALIGN_SIZE);
if (allocSize == 0) {
return NULL;
}
#if OS_MEM_EXPAND_ENABLE
retry:
#endif
@ -1531,13 +1527,13 @@ STATIC INLINE VOID OsMemMagicCheckPrint(struct OsMemNodeHead **tmpNode)
STATIC UINT32 OsMemAddrValidCheckPrint(const VOID *pool, struct OsMemFreeNodeHead **tmpNode)
{
if (!OsMemAddrValidCheck(pool, (*tmpNode)->prev)) {
if (((*tmpNode)->prev != NULL) && !OsMemAddrValidCheck(pool, (*tmpNode)->prev)) {
PRINT_ERR("[%s], %d, memory check error!\n"
" freeNode.prev:%#x is out of legal mem range\n",
__FUNCTION__, __LINE__, (*tmpNode)->prev);
return LOS_NOK;
}
if (!OsMemAddrValidCheck(pool, (*tmpNode)->next)) {
if (((*tmpNode)->next != NULL) && !OsMemAddrValidCheck(pool, (*tmpNode)->next)) {
PRINT_ERR("[%s], %d, memory check error!\n"
" freeNode.next:%#x is out of legal mem range\n",
__FUNCTION__, __LINE__, (*tmpNode)->next);

View File

@ -31,7 +31,7 @@
#include "stdlib.h"
#include "los_memory_pri.h"
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#include "los_excinfo_pri.h"
#endif
#ifdef LOSCFG_SHELL
@ -64,7 +64,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
while (dataLen) {
if (IS_ALIGNED(count, sizeof(CHAR *))) {
PRINTK("\n 0x%lx :", alignAddr);
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
WriteExcInfoToBuf("\n 0x%lx :", alignAddr);
#endif
}
@ -73,7 +73,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
#else
PRINTK("%0+8lx ", *alignAddr);
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#ifdef __LP64__
WriteExcInfoToBuf("0x%0+16x ", *alignAddr);
#else
@ -85,7 +85,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
count++;
}
PRINTK("\n");
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
WriteExcInfoToBuf("\n");
#endif
@ -101,14 +101,14 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdMemCheck(INT32 argc, const CHAR *argv[])
if (LOS_MemIntegrityCheck(m_aucSysMem1) == LOS_OK) {
PRINTK("system memcheck over, all passed!\n");
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
WriteExcInfoToBuf("system memcheck over, all passed!\n");
#endif
}
#ifdef LOSCFG_EXC_INTERACTION
if (LOS_MemIntegrityCheck(m_aucSysMem0) == LOS_OK) {
PRINTK("exc interaction memcheck over, all passed!\n");
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
WriteExcInfoToBuf("exc interaction memcheck over, all passed!\n");
#endif
}

View File

@ -43,7 +43,7 @@
#ifdef LOSCFG_KERNEL_CPUP
#include "los_cpup_pri.h"
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#include "los_excinfo_pri.h"
#endif
#include "los_process_pri.h"

View File

@ -753,7 +753,7 @@ VOID OsSchedTick(VOID)
}
}
VOID OsSchedSetIdleTaskSchedPartam(LosTaskCB *idleTask)
VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask)
{
idleTask->policy = LOS_SCHED_IDLE;
idleTask->initTimeSlice = OS_SCHED_FIFO_TIMEOUT;

View File

@ -238,34 +238,6 @@ STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
return TRUE;
}
LosVmMapRegion *OsShareRegionClone(LosVmMapRegion *oldRegion)
{
/* no need to create vm object */
LosVmMapRegion *newRegion = LOS_MemAlloc(m_aucSysMem0, sizeof(LosVmMapRegion));
if (newRegion == NULL) {
VM_ERR("malloc new region struct failed.");
return NULL;
}
/* todo: */
*newRegion = *oldRegion;
return newRegion;
}
LosVmMapRegion *OsPrivateRegionClone(LosVmMapRegion *oldRegion)
{
/* need to create vm object */
LosVmMapRegion *newRegion = LOS_MemAlloc(m_aucSysMem0, sizeof(LosVmMapRegion));
if (newRegion == NULL) {
VM_ERR("malloc new region struct failed.");
return NULL;
}
/* todo: */
*newRegion = *oldRegion;
return newRegion;
}
STATUS_T LOS_VmSpaceClone(LosVmSpace *oldVmSpace, LosVmSpace *newVmSpace)
{
LosVmMapRegion *oldRegion = NULL;
@ -840,11 +812,6 @@ STATUS_T OsIsRegionCanExpand(LosVmSpace *space, LosVmMapRegion *region, size_t s
return LOS_NOK;
}
/* if next node is head, then we can expand */
if (OsIsVmRegionEmpty(space) == TRUE) {
return LOS_OK;
}
nextRegion = (LosVmMapRegion *)LOS_RbSuccessorNode(&space->regionRbTree, &region->rbNode);
/* if the gap is larger than size, then we can expand */
if ((nextRegion != NULL) && ((nextRegion->range.base - region->range.base) >= size)) {

View File

@ -435,11 +435,6 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
INT32 shmid;
SYSV_SHM_LOCK();
if (!((UINT32)shmflg & IPC_CREAT) &&
((UINT32)shmflg & IPC_EXCL)) {
ret = -EINVAL;
goto ERROR;
}
if (key == IPC_PRIVATE) {
ret = ShmAllocSeg(key, size, shmflg);
@ -454,6 +449,11 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
}
} else {
shmid = ret;
if (((UINT32)shmflg & IPC_CREAT) &&
((UINT32)shmflg & IPC_EXCL)) {
ret = -EEXIST;
goto ERROR;
}
ret = ShmPermCheck(ShmFindSeg(shmid), (UINT32)shmflg & ACCESSPERMS);
if (ret != 0) {
ret = -ret;

View File

@ -111,14 +111,7 @@ INT32 ConsoleTcGetAttr(INT32 fd, struct termios *termios)
struct file *filep = NULL;
CONSOLE_CB *consoleCB = NULL;
if ((fd >= STDIN_FILENO) && (fd <= STDERR_FILENO)) {
fd = ConsoleUpdateFd();
if (fd < STDIN_FILENO) {
return -EBADF;
}
}
int ret = fs_getfilep(fd, &filep);
INT32 ret = fs_getfilep(fd, &filep);
if (ret < 0) {
return -EPERM;
}
@ -128,7 +121,7 @@ INT32 ConsoleTcGetAttr(INT32 fd, struct termios *termios)
return -EFAULT;
}
termios->c_lflag = consoleCB->consoleTermios.c_lflag;
(VOID)memcpy_s(termios, sizeof(struct termios), &consoleCB->consoleTermios, sizeof(struct termios));
return LOS_OK;
}
@ -138,14 +131,8 @@ INT32 ConsoleTcSetAttr(INT32 fd, INT32 actions, const struct termios *termios)
CONSOLE_CB *consoleCB = NULL;
(VOID)actions;
if ((fd >= STDIN_FILENO) && (fd <= STDERR_FILENO)) {
fd = ConsoleUpdateFd();
if (fd < STDIN_FILENO) {
return -EBADF;
}
}
int ret = fs_getfilep(fd, &filep);
INT32 ret = fs_getfilep(fd, &filep);
if (ret < 0) {
return -EPERM;
}
@ -154,7 +141,8 @@ INT32 ConsoleTcSetAttr(INT32 fd, INT32 actions, const struct termios *termios)
if (consoleCB == NULL) {
return -EFAULT;
}
consoleCB->consoleTermios.c_lflag = termios->c_lflag;
(VOID)memcpy_s(&consoleCB->consoleTermios, sizeof(struct termios), termios, sizeof(struct termios));
return LOS_OK;
}
@ -183,14 +171,13 @@ BOOL IsConsoleOccupied(const CONSOLE_CB *consoleCB)
STATIC INT32 ConsoleCtrlCaptureLine(CONSOLE_CB *consoleCB)
{
struct termios *consoleTermios = NULL;
struct termios consoleTermios;
UINT32 intSave;
LOS_SpinLockSave(&g_consoleSpin, &intSave);
consoleTermios = &consoleCB->consoleTermios;
(VOID)ConsoleTcGetAttr(consoleCB->fd, consoleTermios);
consoleTermios->c_lflag |= ICANON | ECHO;
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, consoleTermios);
(VOID)ConsoleTcGetAttr(consoleCB->fd, &consoleTermios);
consoleTermios.c_lflag |= ICANON | ECHO;
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, &consoleTermios);
LOS_SpinUnlockRestore(&g_consoleSpin, intSave);
return LOS_OK;
@ -198,14 +185,13 @@ STATIC INT32 ConsoleCtrlCaptureLine(CONSOLE_CB *consoleCB)
STATIC INT32 ConsoleCtrlCaptureChar(CONSOLE_CB *consoleCB)
{
struct termios *consoleTermios = NULL;
struct termios consoleTermios;
UINT32 intSave;
LOS_SpinLockSave(&g_consoleSpin, &intSave);
consoleTermios = &consoleCB->consoleTermios;
(VOID)ConsoleTcGetAttr(consoleCB->fd, consoleTermios);
consoleTermios->c_lflag &= ~(ICANON | ECHO);
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, consoleTermios);
(VOID)ConsoleTcGetAttr(consoleCB->fd, &consoleTermios);
consoleTermios.c_lflag &= ~(ICANON | ECHO);
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, &consoleTermios);
LOS_SpinUnlockRestore(&g_consoleSpin, intSave);
return LOS_OK;
@ -451,6 +437,20 @@ STATIC VOID StoreReadChar(CONSOLE_CB *consoleCB, char ch, INT32 readcount)
}
}
VOID KillPgrp()
{
INT32 consoleId = -1;
LosProcessCB *process = OsCurrProcessGet();
if ((process->consoleID > CONSOLE_NUM -1 ) || (process->consoleID < 0)) {
return;
}
consoleId = process->consoleID;
CONSOLE_CB *consoleCB = g_console[consoleId];
(VOID)OsKillLock(consoleCB->pgrpId, SIGINT);
}
STATIC INT32 UserFilepRead(CONSOLE_CB *consoleCB, struct file *filep, const struct file_operations_vfs *fops,
CHAR *buffer, size_t bufLen)
{
@ -829,6 +829,75 @@ ERROUT:
return VFS_ERROR;
}
STATIC INT32 ConsoleSetSW(CONSOLE_CB *consoleCB, unsigned long arg)
{
struct termios kerTermios;
UINT32 intSave;
if (LOS_ArchCopyFromUser(&kerTermios, (struct termios *)arg, sizeof(struct termios)) != 0) {
return -EFAULT;
}
LOS_SpinLockSave(&g_consoleSpin, &intSave);
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, &kerTermios);
LOS_SpinUnlockRestore(&g_consoleSpin, intSave);
return LOS_OK;
}
#define DEFAULT_WINDOW_SIZE_COL 80
#define DEFAULT_WINDOW_SIZE_ROW 24
STATIC INT32 ConsoleGetWinSize(unsigned long arg)
{
struct winsize kws = {
.ws_col = DEFAULT_WINDOW_SIZE_COL,
.ws_row = DEFAULT_WINDOW_SIZE_ROW
};
if(LOS_ArchCopyToUser((VOID *)arg, &kws, sizeof(struct winsize)) != 0) {
return -EFAULT;
} else {
return LOS_OK;
}
}
STATIC INT32 ConsoleGetTermios(unsigned long arg)
{
struct file *filep = NULL;
CONSOLE_CB *consoleCB = NULL;
INT32 ret = fs_getfilep(0, &filep);
if (ret < 0) {
return -EPERM;
}
consoleCB = (CONSOLE_CB *)filep->f_priv;
if (consoleCB == NULL) {
return -EFAULT;
}
if(LOS_ArchCopyToUser((VOID *)arg, &consoleCB->consoleTermios, sizeof(struct termios)) != 0) {
return -EFAULT;
} else {
return LOS_OK;
}
}
INT32 ConsoleSetPgrp(CONSOLE_CB *consoleCB, unsigned long arg)
{
if (LOS_ArchCopyFromUser(&consoleCB->pgrpId, (INT32 *)(UINTPTR)arg, sizeof(INT32)) != 0) {
return -EFAULT;
}
return LOS_OK;
}
INT32 ConsoleGetPgrp(CONSOLE_CB *consoleCB, unsigned long arg)
{
if (LOS_ArchCopyToUser((VOID *)arg, &consoleCB->pgrpId, sizeof(INT32)) != 0) {
return -EFAULT;
}
return LOS_OK;
}
STATIC INT32 ConsoleIoctl(struct file *filep, INT32 cmd, unsigned long arg)
{
INT32 ret;
@ -869,6 +938,21 @@ STATIC INT32 ConsoleIoctl(struct file *filep, INT32 cmd, unsigned long arg)
case CONSOLE_CONTROL_REG_USERTASK:
ret = ConsoleTaskReg(consoleCB->consoleID, arg);
break;
case TIOCGWINSZ:
ret = ConsoleGetWinSize(arg);
break;
case TCSETSW:
ret = ConsoleSetSW(consoleCB, arg);
break;
case TCGETS:
ret = ConsoleGetTermios(arg);
break;
case TIOCGPGRP:
ret = ConsoleGetPgrp(consoleCB, arg);
break;
case TIOCSPGRP:
ret = ConsoleSetPgrp(consoleCB, arg);
break;
default:
if ((cmd == UART_CFG_ATTR || cmd == UART_CFG_PRIVATE)
&& !LOS_IsUserAddress(arg)) {
@ -940,6 +1024,7 @@ STATIC VOID OsConsoleTermiosInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
/* set console to have a buffer for user */
(VOID)ConsoleTcGetAttr(consoleCB->fd, &consoleTermios);
consoleTermios.c_lflag |= ICANON | ECHO;
consoleTermios.c_cc[VINTR] = 3; /* /003 for ^C */
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, &consoleTermios);
}
#ifdef LOSCFG_NET_TELNET
@ -950,6 +1035,7 @@ STATIC VOID OsConsoleTermiosInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
/* set console to have a buffer for user */
(VOID)ConsoleTcGetAttr(consoleCB->fd, &consoleTermios);
consoleTermios.c_lflag |= ICANON | ECHO;
consoleTermios.c_cc[VINTR] = 3; /* /003 for ^C */
(VOID)ConsoleTcSetAttr(consoleCB->fd, 0, &consoleTermios);
}
#endif
@ -1005,6 +1091,7 @@ STATIC INT32 OsConsoleDevInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
INT32 ret;
struct file *filep = NULL;
struct Vnode *vnode = NULL;
struct file_operations_vfs *devOps = NULL;
/* allocate memory for filep,in order to unchange the value of filep */
filep = (struct file *)LOS_MemAlloc(m_aucSysMem0, sizeof(struct file));
@ -1040,6 +1127,13 @@ STATIC INT32 OsConsoleDevInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
* Use filep to connect console and uart, we can find uart driver function throught filep.
* now we can operate /dev/console to operate /dev/ttyS0 through filep.
*/
devOps = (struct file_operations_vfs *)((struct drv_data*)vnode->data)->ops;
if (devOps != NULL && devOps->open != NULL) {
(VOID)devOps->open(filep);
} else {
ret = ENOSYS;
goto ERROUT;
}
ret = register_driver(consoleCB->name, &g_consoleDevOps, DEFFILEMODE, filep);
if (ret != LOS_OK) {
@ -1157,6 +1251,7 @@ STATIC CONSOLE_CB *OsConsoleCBInit(UINT32 consoleID)
(VOID)memset_s(consoleCB, sizeof(CONSOLE_CB), 0, sizeof(CONSOLE_CB));
consoleCB->consoleID = consoleID;
consoleCB->pgrpId = -1;
consoleCB->shellEntryId = SHELL_ENTRYID_INVALID; /* initialize shellEntryId to an invalid value */
consoleCB->name = LOS_MemAlloc((VOID *)m_aucSysMem0, CONSOLE_NAMELEN);
if (consoleCB->name == NULL) {
@ -1204,7 +1299,7 @@ STATIC CONSOLE_CB *OsConsoleCreate(UINT32 consoleID, const CHAR *deviceName)
ret = OsConsoleDevInit(consoleCB, deviceName);
if (ret != LOS_OK) {
PRINT_ERR("console OsConsoleDevInitlloc error. %d\n", ret);
PRINT_ERR("console OsConsoleDevInit error. %d\n", ret);
goto ERR_WITH_SEM;
}

View File

@ -80,12 +80,13 @@ typedef struct {
UINT32 consoleID;
UINT32 consoleType;
UINT32 consoleSem;
UINT32 shellEntryId;
UINT32 consoleMask;
struct Vnode *devVnode;
CHAR *name;
INT32 fd;
UINT32 refCount;
UINT32 shellEntryId;
INT32 pgrpId;
BOOL isNonBlock;
#ifdef LOSCFG_SHELL
VOID *shellHandle;
@ -123,6 +124,7 @@ extern INT32 GetFilepOps(const struct file *filep, struct file **privFilep, cons
extern VOID OsWaitConsoleSendTaskPend(UINT32 taskID);
extern VOID OsWakeConsoleSendTask(VOID);
#endif
extern VOID KillPgrp(VOID);
/* console ioctl */
#define CONSOLE_IOC_MAGIC 'c'

View File

@ -117,7 +117,6 @@
#include "los_hilog.h"
#endif
STATIC SystemRebootFunc g_rebootHook = NULL;
VOID OsSetRebootHook(SystemRebootFunc func)
@ -373,7 +372,12 @@ STATIC UINT32 OsSystemInitTaskCreate(VOID)
TSK_INIT_PARAM_S sysTask;
(VOID)memset_s(&sysTask, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
#ifndef LOSCFG_ENABLE_KERNEL_TEST
sysTask.pfnTaskEntry = (TSK_ENTRY_FUNC)SystemInit;
#else
extern void TestSystemInit(void);
sysTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TestSystemInit;
#endif
sysTask.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
sysTask.pcName = "SystemInit";
sysTask.usTaskPrio = LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO;

View File

@ -398,7 +398,7 @@ extern UINT32 __heap_end;
#endif
/****************************** exception information configuration ******************************/
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
/**
* @ingroup los_config
* the size of space for recording exception information

View File

@ -34,9 +34,11 @@
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#ifdef LOSCFG_SHELL
#include "shcmd.h"
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
STATIC log_read_write_fn g_excInfoRW = NULL; /* the hook of read-writing exception information */
STATIC CHAR *g_excInfoBuf = NULL; /* pointer to the buffer for storing the exception information */
STATIC UINT32 g_excInfoIndex = 0xFFFFFFFF; /* the index of the buffer for storing the exception information */
@ -164,5 +166,32 @@ VOID OsRecordExcInfoTime(VOID)
#endif
}
#ifdef LOSCFG_SHELL
INT32 OsShellCmdReadExcInfo(INT32 argc, CHAR **argv)
{
UINT32 recordSpace = GetRecordSpace();
(VOID)argc;
(VOID)argv;
CHAR *buf = (CHAR*)LOS_MemAlloc((void *)OS_SYS_MEM_ADDR, recordSpace + 1);
if (buf == NULL) {
return LOS_NOK;
}
(void)memset_s(buf, recordSpace + 1, 0, recordSpace + 1);
log_read_write_fn hook = GetExcInfoRW();
if (hook != NULL) {
hook(GetRecordAddr(), recordSpace, 1, buf);
}
PRINTK("%s\n", buf);
(VOID)LOS_MemFree((void *)OS_SYS_MEM_ADDR, buf);
buf = NULL;
return LOS_OK;
}
SHELLCMD_ENTRY(readExcInfo_shellcmd, CMD_TYPE_EX, "excInfo", 0, (CmdCallBackFunc)OsShellCmdReadExcInfo);
#endif
#endif

View File

@ -40,7 +40,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
extern VOID SetExcInfoRW(log_read_write_fn func);
extern log_read_write_fn GetExcInfoRW(VOID);
extern VOID SetExcInfoBuf(CHAR *buf);

View File

@ -30,13 +30,13 @@
*/
#include "los_magickey.h"
#include "console.h"
#include "los_task_pri.h"
#ifdef LOSCFG_ENABLE_MAGICKEY
#define MAGIC_KEY_NUM 5
STATIC VOID OsMagicHelp(VOID);
STATIC VOID OsMagicTaskShow(VOID);
STATIC VOID OsMagicPanic(VOID);
@ -66,6 +66,12 @@ STATIC MagicKeyOp g_magicHelpOp = {
.magicKey = 0x1a /* ctrl + z */
};
STATIC MagicKeyOp g_magicKillPgrp = {
.opHandler = KillPgrp,
.helpMsg = "Show all magic op key(ctrl+c) ",
.magicKey = 0x03 /* ctrl + c */
};
/*
* NOTICE:Suggest don't use
* ctrl+h/backspace=0x8,
@ -81,7 +87,7 @@ STATIC MagicKeyOp *g_magicOpTable[MAGIC_KEY_NUM] = {
&g_magicPanicOp, /* ctrl + p */
&g_magicTaskShowOp, /* ctrl + t */
&g_magicHelpOp, /* ctrl + z */
NULL /* rserved */
&g_magicKillPgrp /* ctrl + c */
};
STATIC VOID OsMagicHelp(VOID)
@ -131,7 +137,11 @@ INT32 CheckMagicKey(CHAR key)
PRINTK("Magic key off\n");
}
return 1;
} else if (key == 0x03){ /* ctrl + c */
KillPgrp();
return 0;
}
if (magicKeySwitch != 0) {
for (i = 0; g_magicOpTable[i] != NULL; ++i) {
if (key == g_magicOpTable[i]->magicKey) {

View File

@ -42,7 +42,7 @@
#ifdef LOSCFG_SHELL_DMESG
#include "dmesg_pri.h"
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#include "los_excinfo_pri.h"
#endif
#include "los_exc_pri.h"
@ -250,7 +250,7 @@ VOID PrintExcInfo(const CHAR *fmt, ...)
va_start(ap, fmt);
/* uart output without print-spinlock */
OsVprintf(fmt, ap, EXC_OUTPUT);
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
WriteExcBufVa(fmt, ap);
#endif
va_end(ap);

View File

@ -444,7 +444,7 @@ STATIC VOID OsMountUserdata(const CHAR *fsType)
return;
}
err = get_errno();
if (err == ENOENT) {
if (err == ENOTSUP) {
#ifdef LOSCFG_FS_FAT
ret = format(emmcUserdataDev, 0, FM_FAT32);
if (ret != LOS_OK) {

View File

@ -32,6 +32,7 @@
#include "hm_liteipc.h"
#include "linux/kernel.h"
#include <fs/fs.h>
#include "fs_file.h"
#include "los_mp.h"
#include "los_mux.h"
#include "los_process_pri.h"
@ -43,8 +44,8 @@
#include "los_trace_frame.h"
#endif
#include "los_vm_map.h"
#include "los_vm_phys.h"
#include "los_vm_page.h"
#include "los_vm_phys.h"
#include "los_vm_lock.h"
#define USE_TASKID_AS_HANDLE YES
@ -656,9 +657,22 @@ LITE_OS_SEC_TEXT STATIC BOOL IsTaskAlive(UINT32 taskID)
return TRUE;
}
LITE_OS_SEC_TEXT STATIC UINT32 HandleFd(SpecialObj *obj, BOOL isRollback)
LITE_OS_SEC_TEXT STATIC UINT32 HandleFd(UINT32 processID, SpecialObj *obj, BOOL isRollback)
{
/* now fd is not Isolated between processes, do nothing */
int ret;
if (isRollback == FALSE) {
ret = CopyFdToProc(obj->content.fd, processID);
if (ret < 0) {
return ret;
}
obj->content.fd = ret;
} else {
ret = CloseProcFd(obj->content.fd, processID);
if (ret < 0) {
return ret;
}
}
return LOS_OK;
}
@ -719,7 +733,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 HandleObj(UINT32 dstTid, SpecialObj *obj, BOOL is
UINT32 processID = OS_TCB_FROM_TID(dstTid)->processID;
switch (obj->type) {
case OBJ_FD:
ret = HandleFd(obj, isRollback);
ret = HandleFd(processID, obj, isRollback);
break;
case OBJ_PTR:
ret = HandlePtr(processID, obj, isRollback);

View File

@ -287,7 +287,7 @@ extern UINT32 LOS_EventWrite(PEVENT_CB_S eventCB, UINT32 events);
/**
* @ingroup los_event
* @brief Clear the event occurring in a specified task.
* @brief Clear the event of the eventCB by a specified eventMask.
*
* @par Description:
* <ul>
@ -300,7 +300,7 @@ extern UINT32 LOS_EventWrite(PEVENT_CB_S eventCB, UINT32 events);
* </ul>
*
* @param eventCB [IN/OUT] Pointer to the event control block to be cleared.
* @param events [IN] Mask of the event to be cleared.
* @param eventMask [IN] Mask of the event to be cleared.
*
* @retval #LOS_ERRNO_EVENT_PTR_NULL Null pointer.
* @retval #LOS_OK The event is successfully cleared.
@ -308,7 +308,7 @@ extern UINT32 LOS_EventWrite(PEVENT_CB_S eventCB, UINT32 events);
* <ul><li>los_event.h: the header file that contains the API declaration.</li></ul>
* @see LOS_EventPoll | LOS_EventRead | LOS_EventWrite
*/
extern UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 events);
extern UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 eventMask);
/**
* @ingroup los_event

View File

@ -22,11 +22,4 @@ config SHELL_DMESG
help
Answer Y to enable LiteOS support shell dmesg.
config SHELL_EXCINFO
bool "Enable Shell excInfo"
default n
depends on DEBUG_VERSION && SHELL
help
Answer Y to enable LiteOS support shell excInfo.
endmenu

View File

@ -1,61 +0,0 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "shcmd.h"
#include "los_memory.h"
#ifdef LOSCFG_SHELL_EXCINFO
#include "los_excinfo_pri.h"
INT32 osShellCmdReadExcInfo(INT32 argc, CHAR **argv)
{
UINT32 recordSpace = GetRecordSpace();
(VOID)argc;
(VOID)argv;
CHAR *buf = (CHAR*)LOS_MemAlloc((void *)OS_SYS_MEM_ADDR, recordSpace + 1);
if (buf == NULL) {
return LOS_NOK;
}
(void)memset_s(buf, recordSpace + 1, 0, recordSpace + 1);
log_read_write_fn hook = GetExcInfoRW();
if (hook != NULL) {
hook(GetRecordAddr(), recordSpace, 1, buf);
}
PRINTK("%s\n", buf);
(VOID)LOS_MemFree((void *)OS_SYS_MEM_ADDR, buf);
buf = NULL;
return LOS_OK;
}
SHELLCMD_ENTRY(readExcInfo_shellcmd, CMD_TYPE_EX, "excInfo", 0, (CmdCallBackFunc)osShellCmdReadExcInfo);
#endif

View File

@ -38,6 +38,7 @@
#include "los_syscall.h"
#include "los_task_pri.h"
#include "los_process_pri.h"
#include "los_hw_pri.h"
#include "los_printf.h"
#include "time.h"
#include "utime.h"
@ -93,21 +94,16 @@ void SyscallHandleInit(void)
}
/* The SYSCALL ID is in R7 on entry. Parameters follow in R0..R6 */
LITE_OS_SEC_TEXT UINT32 *OsArmA32SyscallHandle(UINT32 *regs)
VOID OsArmA32SyscallHandle(TaskContext *regs)
{
UINT32 ret;
UINT8 nArgs;
UINTPTR handle;
UINT32 cmd = regs[REG_R7];
UINT32 cmd = regs->reserved2;
if (cmd >= SYS_CALL_NUM) {
PRINT_ERR("Syscall ID: error %d !!!\n", cmd);
return regs;
}
if (cmd == __NR_sigreturn) {
OsRestorSignalContext(regs);
return regs;
return;
}
handle = g_syscallHandle[cmd];
@ -115,35 +111,28 @@ LITE_OS_SEC_TEXT UINT32 *OsArmA32SyscallHandle(UINT32 *regs)
nArgs = (cmd & 1) ? (nArgs >> NARG_BITS) : (nArgs & NARG_MASK);
if ((handle == 0) || (nArgs > ARG_NUM_7)) {
PRINT_ERR("Unsupport syscall ID: %d nArgs: %d\n", cmd, nArgs);
regs[REG_R0] = -ENOSYS;
return regs;
regs->R0 = -ENOSYS;
return;
}
switch (nArgs) {
case ARG_NUM_0:
case ARG_NUM_1:
ret = (*(SyscallFun1)handle)(regs[REG_R0]);
ret = (*(SyscallFun1)handle)(regs->R0);
break;
case ARG_NUM_2:
case ARG_NUM_3:
ret = (*(SyscallFun3)handle)(regs[REG_R0], regs[REG_R1], regs[REG_R2]);
ret = (*(SyscallFun3)handle)(regs->R0, regs->R1, regs->R2);
break;
case ARG_NUM_4:
case ARG_NUM_5:
ret = (*(SyscallFun5)handle)(regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4]);
ret = (*(SyscallFun5)handle)(regs->R0, regs->R1, regs->R2, regs->R3, regs->R4);
break;
default:
ret = (*(SyscallFun7)handle)(regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
regs[REG_R4], regs[REG_R5], regs[REG_R6]);
ret = (*(SyscallFun7)handle)(regs->R0, regs->R1, regs->R2, regs->R3, regs->R4, regs->R5, regs->R6);
}
regs[REG_R0] = ret;
regs->R0 = ret;
OsSaveSignalContext(regs);
/* Return the last value of curent_regs. This supports context switches on return from the exception.
* That capability is only used with theSYS_context_switch system call.
*/
return regs;
return;
}

View File

@ -45,6 +45,5 @@ config TEST
depends on KERNEL_TEST
source "./kernel/Kconfig"
source "./kernel/Kconfig_case"
endmenu

View File

@ -92,7 +92,6 @@ $(LITEOS_TEST_LIBC): $(KERNEL)
$(KERNEL): $(LITEOS_TEST_AUTOCONFIG_H)
$(HIDE)$(MAKE) -C ../ lib || exit 1
#echo "LITEOS_CFLAGS : $(LITEOS_CFLAGS)"
##### make test menuconfig #####
export CONFIG_=LOSCFG_

View File

@ -43,20 +43,6 @@ config TEST_FULL
default y
depends on TEST && TEST_LEVEL
config TEST_PRESSURE
bool "Enable Test Pressure"
default n
depends on TEST && TEST_LEVEL
config TEST_LLT
bool "Enable Test LLT"
default n
depends on TEST && TEST_LEVEL
config TEST_MUTIL
bool "Enable Multi Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_KERNEL_BASE
bool "Enable Kernel Testsuit"
default y
@ -69,90 +55,18 @@ config TEST_KERNEL_BASE_CORE
bool "Enable CORE Testsuit"
default y
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_MP
bool "Enable MP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST && KERNEL_SMP
config TEST_KERNEL_BASE_MEM
bool "Enable MEM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_VM
bool "Enable VM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_MISC
bool "Enable MISC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_OM
bool "Enable OM Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_BASE_ATOMIC
bool "Enable ATOMIC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
config TEST_KERNEL_EXTEND
bool "Enable Extended Kernel Testsuit"
default y
depends on KERNEL_TEST && TEST
config TEST_KERNEL_EXTEND_CPP
bool "Enable CPP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_CPUP
bool "Enable CPUP Testsuit"
default y
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_EXC
bool "Enable EXC Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_UNALIGNACCESS
bool "Enable UNALIGNACCESS Testsuit"
default n
depends on KERNEL_TEST && DO_ALIGN && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_MMU
bool "Enable MMU Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_DYNLOAD
bool "Enable DYNLOAD Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_MPU
bool "Enable MPU Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_RUNSTOP
bool "Enable RUNSTOP Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_RUNSTOP && TEST
config TEST_KERNEL_EXTEND_SCATTER
bool "Enable SCATTER Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_SCATTER && TEST
config TEST_KERNEL_EXTEND_TICKLESS
bool "Enable TICKLESS Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_KERNEL_EXTEND_TRACE
bool "Enable TRACE Testsuit"
default n
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
config TEST_POSIX
bool "Enable Posix Testsuit"
default y
depends on KERNEL_TEST && TEST
config TEST_POSIX_MEM
bool "Enable Mem Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_MQUEUE
bool "Enable Mqueue Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_MUTEX
bool "Enable Mutex Testsuit"
default y
@ -161,266 +75,5 @@ config TEST_POSIX_PTHREAD
bool "Enable Pthread Testsuit"
default y
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SCHED
bool "Enable Sched Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SEM
bool "Enable Sem Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_POSIX_SWTMR
bool "Enable Swtmr Testsuit"
default n
depends on KERNEL_TEST && TEST_POSIX && TEST
config TEST_LINUX
bool "Enable Linux Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LINUX_HRTIMER
bool "Enable Hrtimer Testsuit"
default n
depends on KERNEL_TEST && TEST_LINUX && TEST
config TEST_FS
bool "Enable FS Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_FS_VFS
bool "Enable VFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_JFFS
bool "Enable JFFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_RAMFS
bool "Enable RAMFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_FAT
bool "Enable FAT Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_FAT_FAT32
bool "Enable FAT32 Test"
default n
depends on KERNEL_TEST && TEST_FS_FAT && TEST
config TEST_FAT32_FSCK
bool "Enable FAT32 Fsck Test"
default n
depends on KERNEL_TEST && TEST_FS_FAT && TEST
config TEST_FS_VIRPART
bool "Enable FAT virtual partition test"
default n
depends on KERNEL_TEST && FS_FAT_VIRTUAL_PARTITION && TEST_FS && TEST
config TEST_FS_PROC
bool "Enable PROC Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_FS_NFS
bool "Enable NFS Test"
default n
depends on KERNEL_TEST && TEST_FS && TEST
config TEST_MTD
bool "Enable MTD Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_MTD_JFFS
bool "Enable JFFS MTD Testsuit"
default n
depends on KERNEL_TEST && TEST_MTD && TEST
config TEST_MTD_FAT
bool "Enable FAT MTD Testsuit"
default n
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_MTD_DISK
bool "Enable FAT MTD DISK Test"
default n
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_MTD_FAT_VIRPART
bool "Enable FAT virtual partition MTD test"
default n
depends on KERNEL_TEST && TEST_MTD && FS_FAT_VIRTUAL_PARTITION && TEST
config TEST_DRIVERBASE
bool "Enable DriverBase Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LIBC
bool "Enable LIBC Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_LIBM
bool "Enable LIBM Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_SHELL
bool "Enable Shell Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_USB
bool "Enable Usb Manual Testsuit"
default n
depends on KERNEL_TEST && TEST && DRIVERS_USB
help
config TEST_HOST_MASS_DEVICE
bool "Enable Host Mass Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE && TEST
config TEST_HOST_UVC
bool "Enable Host UVC Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HOST_UVC && TEST
config TEST_DEVICE_MASS_GADGET
bool "Enable Device Mass Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE_GADGET && TEST
config TEST_UVC_GADGET
bool "Enable UVC Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UVC_GADGET && TEST
config TEST_UAC_GADGET
bool "Enable UAC Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UAC_GADGET && TEST
config TEST_CAMERA_GADGET
bool "Enable Camera Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_CAMERA_GADGET && TEST
config TEST_HUB_GADGET
bool "Enable HUB Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_SERIAL_GADGET
bool "Enable Serial Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_SERIAL_GADGET && TEST
config TEST_HID_GADGET
bool "Enable HID Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HID_GADGET && TEST
config TEST_ETHERNET_GADGET
bool "Enable Ethernet Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETHERNET_GADGET && TEST
config TEST_MULTI_GADGET
bool "Enable Ethernet & Serial Gadget Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETH_SER_GADGET && TEST
config TEST_DFU_GADGET
bool "Enable Drivers DFU Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_DFU_GADGET && TEST
config TEST_MUTILDEVICE_GADGET
bool "Enable Drivers Multidevices Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_SMP_USB
bool "Enable Usb SMP Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST && KERNEL_SMP
config TEST_HOST_ETH
bool "Enable Host Eth Testsuit"
default n
depends on KERNEL_TEST && TEST_USB && TEST
config TEST_AUTO_USB
bool "Enable Usb Auto Testsuit"
default n
depends on KERNEL_TEST && TEST && DRIVERS_USB
config TEST_MMC
bool "Enable MMC Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST
config TEST_SD
bool "Enable SD Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
config TEST_SDIO
bool "Enable SDIO Testsuit"
default n
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
comment "Only one platform can be selected"
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
config TEST_SDIO_1131S
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
bool "1131s"
config TEST_SDIO_RTL8189
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
bool "RTL8189"
config TEST_PERFORMANCE
bool "Enable Performance Testsuit"
default n
depends on KERNEL_TEST && TEST
config TEST_PERFORMANCE_CORE
bool "Enable Performance CORE Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_MEM
bool "Enable Performance MEM Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_FS
bool "Enable Performance FS Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_USB
bool "Enable Performance USB Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_PERFORMANCE_NET
bool "Enable Performance NET Testsuit"
default n
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
config TEST_NET
bool "Enable NET Test"
default n
depends on KERNEL_TEST && TEST
help
Attention: if this option turns on, other test suits will be ignored.
config TEST_LWIP
bool "Enable LWIP Testsuit"
default n
depends on KERNEL_TEST && TEST_NET && TEST
config AR6K3_WIFI_TEST
bool "Enable AR6K3_WIFI Test"
default n
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_QRD
help
Attention: if this option turns on, other test suits will be ignored.
config BCM_WIFI_TEST
bool "Enable BCM_WIFI Test"
default n
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_BCM
help
Attention: if this option turns on, other test suits will be ignored.
config TEST_PLATFORM
bool "Enable Platform Testsuit"
default n
depends on KERNEL_TEST && TEST
config 3RDPARTY_TEST
bool "Enable 3rdParty Test"
default n
depends on KERNEL_TEST && TEST && 3RDPARTY
help
Attention: 3rdParty tools and libs test

View File

@ -1,387 +0,0 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
config LOSCFG_TEST_LEVEL
int "Test Level"
default 2
depends on LOSCFG_TESTSUIT_SHELL
help
Attention:
0:smoke test
1:llt test
2:full test
3:presssure test
config LOSCFG_TEST_KERNEL_BASE
bool "Enable Kernel Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_IPC
bool "Enable IPC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_CORE
bool "Enable CORE Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_MEM
bool "Enable MEM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_VM
bool "Enable VM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_MISC
bool "Enable MISC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_OM
bool "Enable OM Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_BASE_ATOMIC
bool "Enable ATOMIC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND
bool "Enable Extended Kernel Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_CPP
bool "Enable CPP Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_CPUP
bool "Enable CPUP Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_EXC
bool "Enable EXC Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_UNALIGNACCESS
bool "Enable UNALIGNACCESS Testsuit"
default n
depends on LOSCFG_DO_ALIGN && LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_MMU
bool "Enable MMU Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_DYNLOAD
bool "Enable DYNLOAD Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_MPU
bool "Enable MPU Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_TICKLESS
bool "Enable TICKLESS Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_KERNEL_EXTEND_TRACE
bool "Enable TRACE Testsuit"
default n
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX
bool "Enable Posix Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MEM
bool "Enable Mem Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MQUEUE
bool "Enable Mqueue Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_MUTEX
bool "Enable Mutex Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_PTHREAD
bool "Enable Pthread Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SCHED
bool "Enable Sched Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SEM
bool "Enable Sem Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_POSIX_SWTMR
bool "Enable Swtmr Testsuit"
default n
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LINUX
bool "Enable Linux Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LINUX_HRTIMER
bool "Enable Hrtimer Testsuit"
default n
depends on LOSCFG_TEST_LINUX && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS
bool "Enable FS Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_VFS
bool "Enable VFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_JFFS
bool "Enable JFFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_RAMFS
bool "Enable RAMFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT
bool "Enable FAT Test"
default n
depends on LOSCFG_TEST_FS && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT_FAT32
bool "Enable FAT32 Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_FAT_EXFAT
bool "Enable exFAT Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FAT32_FSCK
bool "Enable FAT32 Fsck Test"
default n
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_VIRPART
bool "Enable FAT virtual partition test"
default n
depends on LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_PROC
bool "Enable PROC Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_FS_NFS
bool "Enable NFS Test"
default n
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD
bool "Enable MTD Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_JFFS
bool "Enable JFFS MTD Testsuit"
default n
depends on LOSCFG_TEST_MTD && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_FAT
bool "Enable FAT MTD Testsuit"
default n
depends on LOSCFG_TEST_MTD && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MTD_FAT_VIRPART
bool "Enable FAT virtual partition MTD test"
default n
depends on LOSCFG_TEST_MTD && LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DRIVERBASE
bool "Enable DriverBase Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LIBC
bool "Enable LIBC Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_LIBM
bool "Enable LIBM Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SHELL
bool "Enable Shell Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_USB
bool "Enable Usb Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_USB
help
config LOSCFG_TEST_HOST_MASS_DEVICE
bool "Enable Host Mass Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DEVICE_MASS_GADGET
bool "Enable Device Mass Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_UVC_GADGET
bool "Enable UVC Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UVC_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_UAC_GADGET
bool "Enable UAC Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UAC_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_CAMERA_GADGET
bool "Enable Camera Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_CAMERA_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_HUB_GADGET
bool "Enable HUB Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SERIAL_GADGET
bool "Enable Serial Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_SERIAL_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_ETHERNET_GADGET
bool "Enable Ethernet Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETHERNET_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MULTI_GADGET
bool "Enable Ethernet & Serial Gadget Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETH_SER_GADGET && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_DFU_GADGET
bool "Enable Drivers DFU Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MUTILDEVICE_GADGET
bool "Enable Drivers Multidevices Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_HOST_ETH
bool "Enable Host Eth Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_AUTO_USB
bool "Enable Usb auto Testsuit"
default n
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_MMC
bool "Enable MMC Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_MMC
config LOSCFG_TEST_SD
bool "Enable SD Testsuit"
default n
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SDIO
bool "Enable SDIO Testsuit"
default n
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
comment "Only one platform can be selected"
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_SDIO_1131S
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
bool "1131s"
config LOSCFG_TEST_SDIO_RTL8189
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
bool "RTL8189"
config LOSCFG_TEST_PERFORMANCE
bool "Enable Performance Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_CORE
bool "Enable Performance CORE Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_MEM
bool "Enable Performance MEM Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_FS
bool "Enable Performance FS Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_USB
bool "Enable Performance USB Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PERFORMANCE_NET
bool "Enable Performance NET Testsuit"
default n
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_PLATFORM
bool "Enable Platform Testsuit"
default n
depends on LOSCFG_TESTSUIT_SHELL
config LOSCFG_TEST_NET
bool "Enable NET Test"
default n
depends on LOSCFG_TESTSUIT_SHELL
help
Attention: if this option turns on, other test suits will be ignored.
config LOSCFG_TEST_LWIP
bool "Enable LWIP Testsuit"
default n
depends on LOSCFG_TEST_NET && LOSCFG_TESTSUIT_SHELL
config AR6K3_WIFI_TEST
bool "Enable AR6K3_WIFI Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_QRD
help
Attention: if this option turns on, other test suits will be ignored.
config BCM_WIFI_TEST
bool "Enable BCM_WIFI Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_BCM
help
Attention: if this option turns on, other test suits will be ignored.
config LOSCFG_3RDPARTY_TEST
bool "Enable 3rdParty Test"
default n
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_3RDPARTY
help
Attention: 3rdParty tools and libs test
config LOSCFG_TEST_MANUAL_SHELL
bool "Enable Manual Test"
default n
depends on LOSCFG_TESTSUIT_SHELL

View File

@ -94,7 +94,7 @@ extern "C" {
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
} while (0)
} while (0);
#if (LOSCFG_KERNEL_SMP == YES)
#define TEST_TASK_PARAM_INIT_AFFI(testTask, task_name, entry, prio, affi) \

View File

@ -40,7 +40,7 @@ extern "C" {
static void TaskF01(void)
{
while (1) {
Wfi();
WFI;
};
}

View File

@ -40,7 +40,7 @@ extern "C" {
static void TaskF01(void)
{
while (1) {
Wfi();
WFI;
};
}

View File

@ -42,7 +42,7 @@ static void TaskF01(void)
{
LOS_AtomicInc(&g_testCount);
while (1) {
Wfi();
WFI;
}
}

View File

@ -43,7 +43,7 @@ static VOID TaskF01(VOID)
g_testCount++;
ret = LOS_EventRead(&g_event, 0x11, LOS_WAITMODE_AND, 2); // 2, The timeout period for reading events.
ret = LOS_EventRead(&g_event, 0x11, LOS_WAITMODE_AND, 200); // 200, The timeout period for reading events.
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
ICUNIT_GOTO_EQUAL(g_event.uwEventID, 0, g_event.uwEventID, EXIT);
@ -98,6 +98,7 @@ static UINT32 Testcase(VOID)
LOS_TaskUnlock();
LOS_TaskDelay(1);
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert that g_testCount is equal to 2.
EXIT:

View File

@ -98,11 +98,6 @@ VOID ItSuiteLosSem(void)
ItLosSem017();
ItLosSem019();
ItLosSem020();
#if (LOSCFG_KERNEL_SMP != YES)
ItLosSem018();
ItLosSem021();
ItLosSem025();
#endif
ItLosSem022();
ItLosSem023();
ItLosSem026();

View File

@ -294,7 +294,7 @@ VOID TestBusyTaskDelay(UINT32 tick)
if (runtime <= TestTickCountByCurrCpuid()) {
break;
}
Wfi();
WFI;
}
}
@ -307,7 +307,7 @@ VOID TestAssertBusyTaskDelay(UINT32 timeout, UINT32 flag)
if ((runtime <= TestTickCountGet()) || (g_testCount == flag)) {
break;
}
Wfi();
WFI;
}
}

View File

@ -30,23 +30,17 @@
import("config.gni")
local_flags = []
if (board_name == "hispark_taurus") {
local_flags += [ "-DLOSCFG_USER_TEST_SMP" ]
}
if (LOSCFG_USER_TEST_SMOKE == true) {
local_flags += [ "-DLOSCFG_USER_TEST_SMOKE" ]
}
if (LOSCFG_USER_TEST_FULL == true) {
local_flags += [ "-DLOSCFG_USER_TEST_FULL" ]
}
if (LOSCFG_USER_TEST_PRESSURE == true) {
local_flags += [ "-DLOSCFG_USER_TEST_PRESSURE" ]
}
if (LOSCFG_USER_TEST_LLT == true) {
local_flags += [ "-DLOSCFG_USER_TEST_LLT" ]
local_flags_smoke = []
local_flags_full = []
if (LOSCFG_USER_TEST_SMP == "enable" || (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) {
local_flags = [ "-DLOSCFG_USER_TEST_SMP" ]
}
local_flags_smoke += [ "-DLOSCFG_USER_TEST_SMOKE" ]
local_flags_full += [ "-DLOSCFG_USER_TEST_SMOKE" ]
local_flags_full += [ "-DLOSCFG_USER_TEST_FULL" ]
#local_flags_full += [ "-DLOSCFG_USER_TEST_PRESSURE" ]
config("public_config") {
config("local_public_config") {
cflags = [ "-fpermissive" ]
cflags += [
"-O2",
@ -57,99 +51,280 @@ config("public_config") {
cflags_cc = cflags
}
config("public_config_smk") {
cflags = [ "-fpermissive" ]
cflags += [
"-O2",
"-fbuiltin",
"-Wno-narrowing",
]
cflags += local_flags_smoke
cflags += local_flags
cflags_cc = cflags
}
config("public_config_full") {
cflags = [ "-fpermissive" ]
cflags += [
"-O2",
"-fbuiltin",
"-Wno-narrowing",
]
cflags += local_flags_full
cflags += local_flags
cflags_cc = cflags
}
group("unittest") {
deps = []
if (LOSCFG_USER_TEST_UTIL == true) {
deps += [ "util:liteos_a_util_unittest" ]
}
if (LOSCFG_USER_TEST_TIME_TIMER == true) {
deps += [ "time/timer:liteos_a_time_timer_unittest" ]
}
if (LOSCFG_USER_TEST_TIME_CLOCK == true) {
deps += [ "time/clock:liteos_a_time_clock_unittest" ]
}
if (LOSCFG_USER_TEST_SYS == true) {
deps += [ "sys:liteos_a_sys_unittest" ]
}
if (LOSCFG_USER_TEST_SIGNAL == true) {
deps += [ "signal:liteos_a_signal_unittest" ]
}
if (LOSCFG_USER_TEST_SECURITY_REUGID == true) {
deps += [ "security/reugid:liteos_a_security_reugid_unittest" ]
}
if (LOSCFG_USER_TEST_SECURITY_CAPABILITY == true) {
deps += [ "security/capability:liteos_a_security_capability_unittest" ]
}
if (LOSCFG_USER_TEST_SECURITY_VID == true) {
deps += [ "security/vid:liteos_a_security_vid_unittest" ]
}
if (LOSCFG_USER_TEST_MUTEX == true) {
deps += [ "process/mutex:liteos_a_mutex_unittest" ]
}
if (LOSCFG_USER_TEST_PROCESS == true) {
deps += [ "process/process:liteos_a_process_unittest" ]
}
if (LOSCFG_USER_TEST_PTHREAD == true) {
deps += [ "process/pthread:liteos_a_pthread_unittest" ]
}
if (LOSCFG_USER_TEST_RWLOCK == true) {
deps += [ "process/rwlock:liteos_a_rwlock_unittest" ]
}
if (LOSCFG_USER_TEST_SPINLOCK == true) {
deps += [ "process/spinlock:liteos_a_spinlock_unittest" ]
}
if (LOSCFG_USER_TEST_POSIX_MEM == true) {
deps += [ "posix/mem:liteos_a_posix_mem_unittest" ]
}
if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) {
deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest" ]
}
if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) {
deps += [ "posix/pthread:liteos_a_posix_pthread_unittest" ]
}
if (LOSCFG_USER_TEST_MISC == true) {
deps += [ "misc:liteos_a_misc_unittest" ]
}
if (LOSCFG_USER_TEST_MEM_SHM == true) {
deps += [ "mem/shm:liteos_a_mem_shm_unittest" ]
}
if (LOSCFG_USER_TEST_MEM_VM == true) {
deps += [ "mem/vm:liteos_a_mem_vm_unittest" ]
}
if (LOSCFG_USER_TEST_IO == true) {
deps += [ "IO:liteos_a_io_unittest" ]
}
if (LOSCFG_USER_TEST_EXC == true) {
deps += [ "exc:liteos_a_exc_unittest" ]
}
if (LOSCFG_USER_TEST_DYNLOAD == true) {
deps += [ "dynload:liteos_a_dynload_unittest" ]
}
if (LOSCFG_USER_TEST_DRIVERS_HID == true) {
deps += [ "drivers/hid:liteos_a_drivers_hid_unittest" ]
}
if (LOSCFG_USER_TEST_DRIVERS_STORAGE == true) {
deps += [ "drivers/storage:liteos_a_drivers_storage_unittest" ]
}
if (LOSCFG_USER_TEST_NET_NETDB == true) {
deps += [ "net/netdb:liteos_a_net_netdb_unittest" ]
}
if (LOSCFG_USER_TEST_NET_RESOLV == true) {
deps += [ "net/resolv:liteos_a_net_resolv_unittest" ]
}
if (LOSCFG_USER_TEST_NET_SOCKET == true) {
deps += [ "net/socket:liteos_a_net_socket_unittest" ]
}
if (LOSCFG_USER_TEST_IPC == true) {
deps += [ "IPC:liteos_a_ipc_unittest" ]
}
if (LOSCFG_USER_TEST_LITEIPC == true) {
deps += [ "liteipc:liteos_a_liteipc_unittest" ]
}
if (LOSCFG_USER_TEST_FS_JFFS == true) {
deps += [ "fs:liteos_a_fs_unittest" ]
}
if (LOSCFG_USER_TEST_FS_VFAT == true) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest" ]
if (ohos_build_type == "debug") {
if (LOSCFG_USER_TEST_MISC == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "misc:liteos_a_misc_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "misc:liteos_a_misc_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_DRIVERS_HID == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "drivers/hid:liteos_a_drivers_hid_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "drivers/hid:liteos_a_drivers_hid_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_DRIVERS_STORAGE == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "drivers/storage:liteos_a_drivers_storage_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "drivers/storage:liteos_a_drivers_storage_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_DYNLOAD == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "dynload:liteos_a_dynload_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "dynload:liteos_a_dynload_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_EXC == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "exc:liteos_a_exc_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "exc:liteos_a_exc_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_FS_JFFS == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "fs:liteos_a_fs_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "fs:liteos_a_fs_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_FS_VFAT == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_IO == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "IO:liteos_a_io_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "IO:liteos_a_io_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_IPC == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "IPC:liteos_a_ipc_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "IPC:liteos_a_ipc_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_LITEIPC == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "liteipc:liteos_a_liteipc_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "liteipc:liteos_a_liteipc_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_MEM_SHM == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "mem/shm:liteos_a_mem_shm_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "mem/shm:liteos_a_mem_shm_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_MEM_VM == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "mem/vm:liteos_a_mem_vm_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "mem/vm:liteos_a_mem_vm_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_NET_NETDB == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "net/netdb:liteos_a_net_netdb_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "net/netdb:liteos_a_net_netdb_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_NET_RESOLV == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "net/resolv:liteos_a_net_resolv_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "net/resolv:liteos_a_net_resolv_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_NET_SOCKET == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "net/socket:liteos_a_net_socket_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "net/socket:liteos_a_net_socket_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_POSIX_MEM == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "posix/mem:liteos_a_posix_mem_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "posix/mem:liteos_a_posix_mem_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "posix/pthread:liteos_a_posix_pthread_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "posix/pthread:liteos_a_posix_pthread_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_MUTEX == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "process/mutex:liteos_a_mutex_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "process/mutex:liteos_a_mutex_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_PROCESS == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "process/process:liteos_a_process_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "process/process:liteos_a_process_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_PTHREAD == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "process/pthread:liteos_a_pthread_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "process/pthread:liteos_a_pthread_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_RWLOCK == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "process/rwlock:liteos_a_rwlock_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "process/rwlock:liteos_a_rwlock_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SPINLOCK == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "process/spinlock:liteos_a_spinlock_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "process/spinlock:liteos_a_spinlock_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SECURITY_REUGID == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "security/reugid:liteos_a_security_reugid_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "security/reugid:liteos_a_security_reugid_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SECURITY_CAPABILITY == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "security/capability:liteos_a_security_capability_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "security/capability:liteos_a_security_capability_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SECURITY_VID == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "security/vid:liteos_a_security_vid_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "security/vid:liteos_a_security_vid_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_UTIL == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "util:liteos_a_util_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "util:liteos_a_util_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_TIME_TIMER == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "time/timer:liteos_a_time_timer_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "time/timer:liteos_a_time_timer_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_TIME_CLOCK == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "time/clock:liteos_a_time_clock_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "time/clock:liteos_a_time_clock_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SYS == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "sys:liteos_a_sys_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "sys:liteos_a_sys_unittest_door" ]
}
}
if (LOSCFG_USER_TEST_SIGNAL == true) {
if (LOSCFG_USER_TEST_FOR_ALL == true) {
deps += [ "signal:liteos_a_signal_unittest" ]
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
deps += [ "signal:liteos_a_signal_unittest_door" ]
}
}
}
}

View File

@ -28,20 +28,33 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_io_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../common/include",
"../IO",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../IO",
]
sources_entry = [
"../common/osTest.cpp",
"io_test.cpp",
]
source_set("sources_smoke") {
sources = [
"smoke/IO_test_005.cpp",
"smoke/IO_test_008.cpp",
"smoke/IO_test_010.cpp",
"smoke/IO_test_013.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
"../common/osTest.cpp",
"full/IO_test_005.cpp",
"full/IO_test_008.cpp",
"full/IO_test_010.cpp",
"full/IO_test_013.cpp",
"full/IO_test_confstr_001.cpp",
"full/IO_test_dcgettext_001.cpp",
"full/IO_test_dcgettext_002.cpp",
@ -74,13 +87,35 @@ unittest("liteos_a_io_unittest") {
"full/It_stdlib_poll_002.cpp",
"full/It_stdlib_poll_003.cpp",
"full/IO_test_gettext_001.cpp",
#"full/IO_test_ppoll_001.cpp",
#"full/IO_test_ppoll_002.cpp",
#"full/IO_test_pselect_001.cpp",
"full/IO_test_strncasecmp_l_001.cpp",
"full/IO_test_strncasecmp_l_002.cpp",
"io_test.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "..:public_config" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_io_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_io_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -43,6 +43,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: IT_TEST_IO_005
* @tc.desc: function for IoTest
@ -89,7 +90,9 @@ HWTEST_F(IoTest, ItTestIo013, TestSize.Level0)
{
ItTestIo013();
}
#endif
#if defined(LOSCFG_USER_TEST_FULL)
/* *
* @tc.name: IT_STDLIB_POLL_002
* @tc.desc: function for IoTest
@ -233,5 +236,5 @@ HWTEST_F(IoTest, ItStdioMbrlen001, TestSize.Level0)
{
ItStdioMbrlen001();
}
#endif
} // namespace OHOS

View File

@ -28,20 +28,58 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_ipc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../common/include",
"../IPC",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../IPC",
]
sources_entry = [
"../common/osTest.cpp",
"ipc_test.cpp",
]
source_set("sources_smoke") {
sources = [
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
"../common/osTest.cpp",
"full/IPC_test_mkfifoat_001.cpp",
"full/IPC_test_mkfifoat_002.cpp",
"ipc_test.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "..:public_config" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_ipc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_ipc_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -41,6 +41,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_FULL)
/* *
* @tc.name: IPC_TEST_MKFIFOAT_001
* @tc.desc: function for IoTest:mkfifoat-normal test
@ -66,4 +67,5 @@ HWTEST_F(IoTest, IPC_TEST_MKFIFOAT_002, TestSize.Level0)
IPC_TEST_MKFIFOAT_002();
}
#endif
#endif
} // namespace OHOS

View File

@ -68,9 +68,6 @@
#define OK 0
#endif
#define LOSCFG_USER_TEST_SMOKE 1
#define LOSCFG_USER_TEST_FULL 1
#define dprintf printf
#define ENOERR OK
#define LOSCFG_BASE_CORE_TSK_CONFIG 1024

View File

@ -27,19 +27,30 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LOSCFG_USER_TEST_LLT = false
LOSCFG_USER_TEST_SMOKE = true
LOSCFG_USER_TEST_FOR_DOOR = true
LOSCFG_USER_TEST_FOR_ALL = false
LOSCFG_USER_TEST_PRESSURE = false
LOSCFG_USER_TEST_FULL = true
LOSCFG_USER_TEST_DRIVERS_STORAGE = true
# "default": depend on board_name
# "enable": those testsuites testing for SMP is enable
# "disable" those testsuites is disable
LOSCFG_USER_TEST_SMP = "default"
LOSCFG_USER_TEST_MISC = true
LOSCFG_USER_TEST_DRIVERS_HID = true
LOSCFG_USER_TEST_DRIVERS_STORAGE = true
LOSCFG_USER_TEST_DYNLOAD = true
LOSCFG_USER_TEST_EXC = true
LOSCFG_USER_TEST_FS_JFFS = false
LOSCFG_USER_TEST_FS_VFAT = false
LOSCFG_USER_TEST_IO = true
LOSCFG_USER_TEST_IPC = false
LOSCFG_USER_TEST_LITEIPC = false
LOSCFG_USER_TEST_MEM_VM = true
LOSCFG_USER_TEST_MEM_SHM = true
LOSCFG_USER_TEST_MISC = true
LOSCFG_USER_TEST_NET_NETDB = true
LOSCFG_USER_TEST_NET_RESOLV = true
LOSCFG_USER_TEST_NET_SOCKET = true
LOSCFG_USER_TEST_POSIX_PTHREAD = false
LOSCFG_USER_TEST_POSIX_MQUEUE = true
LOSCFG_USER_TEST_POSIX_MEM = true
@ -55,11 +66,4 @@ LOSCFG_USER_TEST_SIGNAL = true
LOSCFG_USER_TEST_SYS = true
LOSCFG_USER_TEST_TIME_CLOCK = true
LOSCFG_USER_TEST_TIME_TIMER = true
LOSCFG_USER_TEST_UTIL = true
LOSCFG_USER_TEST_NET_NETDB = true
LOSCFG_USER_TEST_NET_RESOLV = true
LOSCFG_USER_TEST_NET_SOCKET = true
LOSCFG_USER_TEST_IPC = false
LOSCFG_USER_TEST_LITEIPC = false
LOSCFG_USER_TEST_FS_JFFS = true
LOSCFG_USER_TEST_FS_VFAT = true
LOSCFG_USER_TEST_UTIL = true

View File

@ -28,19 +28,57 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../../config.gni")
unittest("liteos_a_drivers_hid_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../../common/include",
"../../drivers/hid",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
"../../drivers/hid",
]
sources_entry = [
"../../common/osTest.cpp",
"drivers_hid_test.cpp",
]
source_set("sources_smoke") {
sources = [
"../../common/osTest.cpp",
"drivers_hid_test.cpp",
"smoke/hid_test_001.cpp",
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "../..:public_config" ]
}
source_set("sources_other") {
sources = [
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_drivers_hid_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_drivers_hid_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -40,6 +40,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: it_test_hid_001
* @tc.desc: function for drivers hid
@ -50,4 +51,5 @@ HWTEST_F(DriversHidTest, ItTestHid001, TestSize.Level0)
{
ItTestHid001();
}
#endif
} // namespace OHOS

View File

@ -28,18 +28,57 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../../config.gni")
unittest("liteos_a_drivers_storage_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../../common/include",
"../../drivers/storage",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
"../../drivers/storage",
]
sources_entry = [
"../../common/osTest.cpp",
"drivers_storage_test.cpp",
]
source_set("sources_smoke") {
sources = [
"../../common/osTest.cpp",
"drivers_storage_test.cpp",
"smoke/storage_test_001.cpp",
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_drivers_storage_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_drivers_storage_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -40,6 +40,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: it_test_storage_001
* @tc.desc: function for drivers storage
@ -50,4 +51,5 @@ HWTEST_F(DriversStorageTest, ItTestStorage001, TestSize.Level0)
{
ItTestStorage001();
}
#endif
} // namespace OHOS

View File

@ -28,20 +28,58 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_dynload_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../common/include",
"../dynload",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../dynload",
]
sources_entry = [
"../common/osTest.cpp",
"dynload_test.cpp",
]
source_set("sources_smoke") {
sources = [
"../common/osTest.cpp",
"dynload_test.cpp",
"smoke/dynload_test_002.cpp",
"smoke/dynload_test_004.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "..:public_config" ]
}
source_set("sources_other") {
sources = [
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_dynload_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_dynload_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -41,6 +41,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: it_test_dynload_002
* @tc.desc: function for DynloadTest
@ -62,4 +63,5 @@ HWTEST_F(DynloadTest, ItTestDynload004, TestSize.Level0)
{
ItTestDynload004();
}
#endif
} // namespace OHOS

View File

@ -28,24 +28,62 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_exc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../common/include",
"../exc",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../exc",
]
sources_entry = [
"../common/osTest.cpp",
"exc_test.cpp",
]
source_set("sources_smoke") {
sources = [
"smoke/it_test_exc_001.cpp",
"smoke/it_test_exc_002.cpp",
"smoke/it_test_exc_003.cpp",
"smoke/it_test_exc_004.cpp",
"smoke/it_test_exc_005.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
"../common/osTest.cpp",
"exc_test.cpp",
"full/it_test_exc_001.cpp",
"full/it_test_exc_002.cpp",
"full/it_test_exc_003.cpp",
"full/it_test_exc_004.cpp",
"full/it_test_exc_005.cpp",
"full/it_test_fexecve_001.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "..:public_config" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_exc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_exc_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -41,6 +41,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: ItTestExc005
* @tc.desc: function for ExcTest
@ -95,5 +96,5 @@ HWTEST_F(ExcTest, ItTestExc004, TestSize.Level0)
{
ItTestExc004();
}
#endif
} // namespace OHOS

View File

@ -28,18 +28,197 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_fs_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"//kernel/liteos_a/testsuites/unittest/common/include",
"//kernel/liteos_a/testsuites/unittest/fs/vfs",
"//kernel/liteos_a/testsuites/unittest/fs/jffs",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"//kernel/liteos_a/testsuites/unittest/fs/vfs",
"//kernel/liteos_a/testsuites/unittest/fs/jffs",
"../common/include",
]
sources_entry = [
"../common/osTest.cpp",
"jffs/vfs_jffs_test.cpp",
]
source_set("sources_smoke") {
sources = [
"jffs/smoke/It_vfs_jffs_001.cpp",
"jffs/smoke/It_vfs_jffs_002.cpp",
"jffs/smoke/It_vfs_jffs_003.cpp",
"jffs/smoke/It_vfs_jffs_005.cpp",
"jffs/smoke/It_vfs_jffs_021.cpp",
"jffs/smoke/It_vfs_jffs_022.cpp",
"jffs/smoke/It_vfs_jffs_026.cpp",
"jffs/smoke/It_vfs_jffs_027.cpp",
"jffs/smoke/It_vfs_jffs_034.cpp",
"jffs/smoke/It_vfs_jffs_035.cpp",
"jffs/smoke/It_vfs_jffs_094.cpp",
"jffs/smoke/It_vfs_jffs_095.cpp",
#"jffs/smoke/It_vfs_jffs_103.cpp",
"jffs/smoke/It_vfs_jffs_535.cpp",
"jffs/smoke/It_vfs_jffs_Dac_001.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_PRESSURE == true) {
source_set("sources_pressure") {
sources = [
"jffs/pressure/It_fs_jffs_performance_001.cpp",
"jffs/pressure/It_fs_jffs_performance_002.cpp",
"jffs/pressure/It_fs_jffs_performance_003.cpp",
"jffs/pressure/It_fs_jffs_performance_004.cpp",
"jffs/pressure/It_fs_jffs_performance_005.cpp",
"jffs/pressure/It_fs_jffs_performance_006.cpp",
"jffs/pressure/It_fs_jffs_performance_007.cpp",
"jffs/pressure/It_fs_jffs_performance_008.cpp",
"jffs/pressure/It_fs_jffs_performance_009.cpp",
"jffs/pressure/It_fs_jffs_performance_010.cpp",
"jffs/pressure/It_fs_jffs_performance_011.cpp",
"jffs/pressure/It_fs_jffs_performance_012.cpp",
"jffs/pressure/It_fs_jffs_performance_013.cpp",
"jffs/pressure/It_fs_jffs_pressure_001.cpp",
"jffs/pressure/It_fs_jffs_pressure_002.cpp",
"jffs/pressure/It_fs_jffs_pressure_003.cpp",
"jffs/pressure/It_fs_jffs_pressure_004.cpp",
"jffs/pressure/It_fs_jffs_pressure_005.cpp",
"jffs/pressure/It_fs_jffs_pressure_006.cpp",
"jffs/pressure/It_fs_jffs_pressure_007.cpp",
"jffs/pressure/It_fs_jffs_pressure_008.cpp",
"jffs/pressure/It_fs_jffs_pressure_009.cpp",
"jffs/pressure/It_fs_jffs_pressure_010.cpp",
"jffs/pressure/It_fs_jffs_pressure_011.cpp",
"jffs/pressure/It_fs_jffs_pressure_012.cpp",
"jffs/pressure/It_fs_jffs_pressure_014.cpp",
"jffs/pressure/It_fs_jffs_pressure_015.cpp",
"jffs/pressure/It_fs_jffs_pressure_016.cpp",
"jffs/pressure/It_fs_jffs_pressure_017.cpp",
"jffs/pressure/It_fs_jffs_pressure_018.cpp",
"jffs/pressure/It_fs_jffs_pressure_019.cpp",
"jffs/pressure/It_fs_jffs_pressure_020.cpp",
"jffs/pressure/It_fs_jffs_pressure_021.cpp",
"jffs/pressure/It_fs_jffs_pressure_022.cpp",
"jffs/pressure/It_fs_jffs_pressure_023.cpp",
"jffs/pressure/It_fs_jffs_pressure_024.cpp",
"jffs/pressure/It_fs_jffs_pressure_025.cpp",
"jffs/pressure/It_fs_jffs_pressure_026.cpp",
"jffs/pressure/It_fs_jffs_pressure_027.cpp",
"jffs/pressure/It_fs_jffs_pressure_028.cpp",
"jffs/pressure/It_fs_jffs_pressure_029.cpp",
"jffs/pressure/It_fs_jffs_pressure_030.cpp",
"jffs/pressure/It_fs_jffs_pressure_031.cpp",
"jffs/pressure/It_fs_jffs_pressure_032.cpp",
"jffs/pressure/It_fs_jffs_pressure_033.cpp",
"jffs/pressure/It_fs_jffs_pressure_034.cpp",
"jffs/pressure/It_fs_jffs_pressure_035.cpp",
"jffs/pressure/It_fs_jffs_pressure_036.cpp",
"jffs/pressure/It_fs_jffs_pressure_037.cpp",
"jffs/pressure/It_fs_jffs_pressure_038.cpp",
"jffs/pressure/It_fs_jffs_pressure_039.cpp",
"jffs/pressure/It_fs_jffs_pressure_040.cpp",
"jffs/pressure/It_fs_jffs_pressure_041.cpp",
"jffs/pressure/It_fs_jffs_pressure_042.cpp",
"jffs/pressure/It_fs_jffs_pressure_043.cpp",
"jffs/pressure/It_fs_jffs_pressure_044.cpp",
"jffs/pressure/It_fs_jffs_pressure_045.cpp",
"jffs/pressure/It_fs_jffs_pressure_046.cpp",
"jffs/pressure/It_fs_jffs_pressure_047.cpp",
"jffs/pressure/It_fs_jffs_pressure_048.cpp",
"jffs/pressure/It_fs_jffs_pressure_049.cpp",
"jffs/pressure/It_fs_jffs_pressure_050.cpp",
"jffs/pressure/It_fs_jffs_pressure_051.cpp",
"jffs/pressure/It_fs_jffs_pressure_052.cpp",
"jffs/pressure/It_fs_jffs_pressure_053.cpp",
"jffs/pressure/It_fs_jffs_pressure_301.cpp",
"jffs/pressure/It_fs_jffs_pressure_302.cpp",
#"jffs/pressure/It_fs_jffs_pressure_303.cpp",
"jffs/pressure/It_fs_jffs_pressure_304.cpp",
"jffs/pressure/It_fs_jffs_pressure_305.cpp",
"jffs/pressure/It_fs_jffs_pressure_306.cpp",
"jffs/pressure/It_fs_jffs_pressure_307.cpp",
"jffs/pressure/It_fs_jffs_pressure_308.cpp",
"jffs/pressure/It_fs_jffs_pressure_309.cpp",
"jffs/pressure/It_fs_jffs_pressure_310.cpp",
"jffs/pressure/It_fs_jffs_pressure_311.cpp",
"jffs/pressure/It_fs_jffs_pressure_312.cpp",
"jffs/pressure/It_fs_jffs_pressure_313.cpp",
"jffs/pressure/It_fs_jffs_pressure_314.cpp",
"jffs/pressure/It_fs_jffs_pressure_315.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_001.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_002.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_003.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_004.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_005.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_006.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_007.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_008.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_009.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_010.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_011.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_012.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_013.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_014.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_015.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_016.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_017.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_018.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_019.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_020.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_021.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_022.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_023.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_024.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_025.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_026.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_027.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_028.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_029.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_030.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_031.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_032.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_033.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_034.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_035.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_036.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_037.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_038.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_039.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_040.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_041.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_042.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_043.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_044.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_045.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_046.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_047.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_048.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_049.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_050.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_051.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_052.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_053.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_054.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_055.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_056.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_057.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_058.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_059.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_060.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_061.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_062.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_063.cpp",
]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
source_set("sources_other") {
sources = [
"//kernel/liteos_a/testsuites/unittest/common/osTest.cpp",
"jffs/vfs_jffs_test.cpp",
"jffs/full/It_jffs_001.cpp",
"jffs/full/It_jffs_002.cpp",
"jffs/full/It_jffs_003.cpp",
@ -612,169 +791,36 @@ unittest("liteos_a_fs_unittest") {
"jffs/full/It_vfs_jffs_701.cpp",
"jffs/full/It_vfs_jffs_807.cpp",
"jffs/full/It_vfs_jffs_808.cpp",
"jffs/smoke/It_vfs_jffs_001.cpp",
"jffs/smoke/It_vfs_jffs_002.cpp",
"jffs/smoke/It_vfs_jffs_003.cpp",
"jffs/smoke/It_vfs_jffs_005.cpp",
"jffs/smoke/It_vfs_jffs_021.cpp",
"jffs/smoke/It_vfs_jffs_022.cpp",
"jffs/smoke/It_vfs_jffs_026.cpp",
"jffs/smoke/It_vfs_jffs_027.cpp",
"jffs/smoke/It_vfs_jffs_034.cpp",
"jffs/smoke/It_vfs_jffs_035.cpp",
"jffs/smoke/It_vfs_jffs_094.cpp",
"jffs/smoke/It_vfs_jffs_095.cpp",
#"jffs/smoke/It_vfs_jffs_103.cpp",
"jffs/smoke/It_vfs_jffs_535.cpp",
"jffs/smoke/It_vfs_jffs_Dac_001.cpp",
"jffs/pressure/It_fs_jffs_performance_001.cpp",
"jffs/pressure/It_fs_jffs_performance_002.cpp",
"jffs/pressure/It_fs_jffs_performance_003.cpp",
"jffs/pressure/It_fs_jffs_performance_004.cpp",
"jffs/pressure/It_fs_jffs_performance_005.cpp",
"jffs/pressure/It_fs_jffs_performance_006.cpp",
"jffs/pressure/It_fs_jffs_performance_007.cpp",
"jffs/pressure/It_fs_jffs_performance_008.cpp",
"jffs/pressure/It_fs_jffs_performance_009.cpp",
"jffs/pressure/It_fs_jffs_performance_010.cpp",
"jffs/pressure/It_fs_jffs_performance_011.cpp",
"jffs/pressure/It_fs_jffs_performance_012.cpp",
"jffs/pressure/It_fs_jffs_performance_013.cpp",
"jffs/pressure/It_fs_jffs_pressure_001.cpp",
"jffs/pressure/It_fs_jffs_pressure_002.cpp",
"jffs/pressure/It_fs_jffs_pressure_003.cpp",
"jffs/pressure/It_fs_jffs_pressure_004.cpp",
"jffs/pressure/It_fs_jffs_pressure_005.cpp",
"jffs/pressure/It_fs_jffs_pressure_006.cpp",
"jffs/pressure/It_fs_jffs_pressure_007.cpp",
"jffs/pressure/It_fs_jffs_pressure_008.cpp",
"jffs/pressure/It_fs_jffs_pressure_009.cpp",
"jffs/pressure/It_fs_jffs_pressure_010.cpp",
"jffs/pressure/It_fs_jffs_pressure_011.cpp",
"jffs/pressure/It_fs_jffs_pressure_012.cpp",
"jffs/pressure/It_fs_jffs_pressure_014.cpp",
"jffs/pressure/It_fs_jffs_pressure_015.cpp",
"jffs/pressure/It_fs_jffs_pressure_016.cpp",
"jffs/pressure/It_fs_jffs_pressure_017.cpp",
"jffs/pressure/It_fs_jffs_pressure_018.cpp",
"jffs/pressure/It_fs_jffs_pressure_019.cpp",
"jffs/pressure/It_fs_jffs_pressure_020.cpp",
"jffs/pressure/It_fs_jffs_pressure_021.cpp",
"jffs/pressure/It_fs_jffs_pressure_022.cpp",
"jffs/pressure/It_fs_jffs_pressure_023.cpp",
"jffs/pressure/It_fs_jffs_pressure_024.cpp",
"jffs/pressure/It_fs_jffs_pressure_025.cpp",
"jffs/pressure/It_fs_jffs_pressure_026.cpp",
"jffs/pressure/It_fs_jffs_pressure_027.cpp",
"jffs/pressure/It_fs_jffs_pressure_028.cpp",
"jffs/pressure/It_fs_jffs_pressure_029.cpp",
"jffs/pressure/It_fs_jffs_pressure_030.cpp",
"jffs/pressure/It_fs_jffs_pressure_031.cpp",
"jffs/pressure/It_fs_jffs_pressure_032.cpp",
"jffs/pressure/It_fs_jffs_pressure_033.cpp",
"jffs/pressure/It_fs_jffs_pressure_034.cpp",
"jffs/pressure/It_fs_jffs_pressure_035.cpp",
"jffs/pressure/It_fs_jffs_pressure_036.cpp",
"jffs/pressure/It_fs_jffs_pressure_037.cpp",
"jffs/pressure/It_fs_jffs_pressure_038.cpp",
"jffs/pressure/It_fs_jffs_pressure_039.cpp",
"jffs/pressure/It_fs_jffs_pressure_040.cpp",
"jffs/pressure/It_fs_jffs_pressure_041.cpp",
"jffs/pressure/It_fs_jffs_pressure_042.cpp",
"jffs/pressure/It_fs_jffs_pressure_043.cpp",
"jffs/pressure/It_fs_jffs_pressure_044.cpp",
"jffs/pressure/It_fs_jffs_pressure_045.cpp",
"jffs/pressure/It_fs_jffs_pressure_046.cpp",
"jffs/pressure/It_fs_jffs_pressure_047.cpp",
"jffs/pressure/It_fs_jffs_pressure_048.cpp",
"jffs/pressure/It_fs_jffs_pressure_049.cpp",
"jffs/pressure/It_fs_jffs_pressure_050.cpp",
"jffs/pressure/It_fs_jffs_pressure_051.cpp",
"jffs/pressure/It_fs_jffs_pressure_052.cpp",
"jffs/pressure/It_fs_jffs_pressure_053.cpp",
"jffs/pressure/It_fs_jffs_pressure_301.cpp",
"jffs/pressure/It_fs_jffs_pressure_302.cpp",
#"jffs/pressure/It_fs_jffs_pressure_303.cpp",
"jffs/pressure/It_fs_jffs_pressure_304.cpp",
"jffs/pressure/It_fs_jffs_pressure_305.cpp",
"jffs/pressure/It_fs_jffs_pressure_306.cpp",
"jffs/pressure/It_fs_jffs_pressure_307.cpp",
"jffs/pressure/It_fs_jffs_pressure_308.cpp",
"jffs/pressure/It_fs_jffs_pressure_309.cpp",
"jffs/pressure/It_fs_jffs_pressure_310.cpp",
"jffs/pressure/It_fs_jffs_pressure_311.cpp",
"jffs/pressure/It_fs_jffs_pressure_312.cpp",
"jffs/pressure/It_fs_jffs_pressure_313.cpp",
"jffs/pressure/It_fs_jffs_pressure_314.cpp",
"jffs/pressure/It_fs_jffs_pressure_315.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_001.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_002.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_003.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_004.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_005.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_006.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_007.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_008.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_009.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_010.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_011.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_012.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_013.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_014.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_015.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_016.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_017.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_018.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_019.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_020.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_021.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_022.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_023.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_024.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_025.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_026.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_027.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_028.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_029.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_030.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_031.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_032.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_033.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_034.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_035.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_036.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_037.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_038.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_039.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_040.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_041.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_042.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_043.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_044.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_045.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_046.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_047.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_048.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_049.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_050.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_051.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_052.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_053.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_054.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_055.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_056.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_057.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_058.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_059.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_060.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_061.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_062.cpp",
"jffs/pressure/It_vfs_jffs_multipthread_063.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "//kernel/liteos_a/testsuites/unittest:public_config" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_fs_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
if (LOSCFG_USER_TEST_PRESSURE == true) {
deps += [ ":sources_pressure" ]
}
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_fs_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -371,6 +371,58 @@ static int TestAccess(const char *path)
return 0;
}
static int SetReadAndSearch()
{
int capNum = 2;
struct __user_cap_header_struct capheader;
struct __user_cap_data_struct capdata[capNum];
int ret;
memset(&capheader, 0, sizeof(struct __user_cap_header_struct));
memset(capdata, 0, capNum * sizeof(struct __user_cap_data_struct));
capdata[0].permitted = 0xffffffff;
capdata[1].permitted = 0xffffffff;
capheader.version = _LINUX_CAPABILITY_VERSION_3;
capdata[CAP_TO_INDEX(CAP_SETPCAP)].effective |= CAP_TO_MASK(CAP_SETPCAP);
capdata[CAP_TO_INDEX(CAP_SETUID)].effective |= CAP_TO_MASK(CAP_SETUID);
capdata[CAP_TO_INDEX(CAP_SETGID)].effective |= CAP_TO_MASK(CAP_SETGID);
capdata[CAP_TO_INDEX(CAP_CHOWN)].effective |= CAP_TO_MASK(CAP_CHOWN);
capdata[CAP_TO_INDEX(CAP_DAC_READ_SEARCH)].effective |= CAP_TO_MASK(CAP_DAC_READ_SEARCH);
ret = capset(&capheader, &capdata[0]);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return 0;
}
static int TestCapReadSearch()
{
int ret;
char filenameParent[64] = {0};
char filenameChild[64] = {0};
ret = setuid(0);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = setgid(0);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = mkdir("/storage/test_jffs2", 0757); // mode 0757
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
sprintf(filenameParent, "%s/%s", "/storage/test_jffs2", "testParent");
sprintf(filenameChild, "%s/%s", filenameParent, "testChild");
ret = mkdir(filenameParent, 0222); // mode 0222
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
SetReadAndSearch();
ret = mkdir(filenameChild, 0777); // mode 0777
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
ret = rmdir(filenameParent);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = rmdir("/storage/test_jffs2");
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
return 0;
}
/* execve */
/* access */
@ -433,9 +485,6 @@ static int ChildFunc(VOID)
ret = setgid(2); // gid: 2
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
capdata[0].effective = 0xffffffff;
capdata[1].effective = 0xffffffff;
(void)capset(&capheader, capdata);
return 0;
}
@ -444,13 +493,24 @@ static int testcase(VOID)
int ret;
int status = 0;
pid_t pid = fork();
ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT);
ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000
if (pid == 0) {
ret = ChildFunc();
printf("err line :%d error code: %d\n", 0, 0);
exit(0);
}
ret = waitpid(pid, &status, 0);
ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT);
pid = fork();
ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000
if (pid == 0) {
ret = TestCapReadSearch();
printf("err line :%d error code: %d\n", 0, 0);
exit(0);
}
ret = waitpid(pid, &status, 0);
ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT);
status = WEXITSTATUS(status);

View File

@ -28,17 +28,29 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../../config.gni")
unittest("liteos_a_fs_procfs_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"//kernel/liteos_a/test/unittest/common/include",
"//kernel/liteos_a/test/unittest/fs/proc",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
"//kernel/liteos_a/test/unittest/fs/proc",
]
sources_entry = [
"../../common/osTest.cpp",
"It_vfs_proc.cpp",
]
source_set("sources_smoke") {
sources = [
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
"//kernel/liteos_a/test/unittest/common/osTest.cpp",
"It_vfs_proc.cpp",
"full/It_vfs_proc_001.cpp",
"full/It_vfs_proc_002.cpp",
"full/It_vfs_proc_003.cpp",
@ -46,7 +58,32 @@ unittest("liteos_a_fs_procfs_unittest") {
"full/It_vfs_proc_005.cpp",
"full/It_vfs_proc_006.cpp",
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "//kernel/liteos_a/test/unittest:public_config" ]
deps += [ "//kernel/liteos_a:kernel" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_fs_procfs_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_fs_procfs_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -28,18 +28,105 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../../config.gni")
unittest("liteos_a_fs_vfat_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"//kernel/liteos_a/testsuites/unittest/common/include",
"//kernel/liteos_a/testsuites/unittest/fs/vfs",
"//kernel/liteos_a/testsuites/unittest/fs/vfat2",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
"//kernel/liteos_a/testsuites/unittest/fs/vfs",
"//kernel/liteos_a/testsuites/unittest/fs/vfat2",
]
sources_entry = [
"../../common/osTest.cpp",
"VfsFatTest.cpp",
]
source_set("sources_smoke") {
sources = [
"smoke/It_vfs_fat_026.cpp",
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_PRESSURE == true) {
source_set("sources_pressure") {
sources = [
"pressure/It_fs_fat_performance_001.cpp",
"pressure/It_fs_fat_performance_002.cpp",
"pressure/It_fs_fat_performance_003.cpp",
"pressure/It_fs_fat_performance_004.cpp",
"pressure/It_fs_fat_performance_005.cpp",
"pressure/It_fs_fat_performance_006.cpp",
"pressure/It_fs_fat_performance_007.cpp",
"pressure/It_fs_fat_performance_008.cpp",
"pressure/It_fs_fat_performance_013.cpp",
"pressure/It_fs_fat_performance_014.cpp",
"pressure/It_fs_fat_performance_015.cpp",
"pressure/It_fs_fat_performance_016.cpp",
"pressure/It_fs_fat_pressure_029.cpp",
"pressure/It_fs_fat_pressure_030.cpp",
"pressure/It_fs_fat_pressure_031.cpp",
"pressure/It_fs_fat_pressure_038.cpp",
"pressure/It_fs_fat_pressure_040.cpp",
"pressure/It_fs_fat_pressure_041.cpp",
"pressure/It_fs_fat_pressure_042.cpp",
"pressure/It_fs_fat_pressure_301.cpp",
"pressure/It_fs_fat_pressure_302.cpp",
"pressure/It_fs_fat_pressure_303.cpp",
"pressure/It_fs_fat_pressure_305.cpp",
"pressure/It_fs_fat_pressure_306.cpp",
"pressure/It_fs_fat_pressure_309.cpp",
"pressure/It_vfs_fat_mutipthread_003.cpp",
"pressure/It_vfs_fat_mutipthread_004.cpp",
"pressure/It_vfs_fat_mutipthread_005.cpp",
"pressure/It_vfs_fat_mutipthread_006.cpp",
"pressure/It_vfs_fat_mutipthread_008.cpp",
"pressure/It_vfs_fat_mutipthread_009.cpp",
"pressure/It_vfs_fat_mutipthread_010.cpp",
"pressure/It_vfs_fat_mutipthread_012.cpp",
"pressure/It_vfs_fat_mutipthread_014.cpp",
"pressure/It_vfs_fat_mutipthread_016.cpp",
"pressure/It_vfs_fat_mutipthread_017.cpp",
"pressure/It_vfs_fat_mutipthread_018.cpp",
"pressure/It_vfs_fat_mutipthread_019.cpp",
"pressure/It_vfs_fat_mutipthread_020.cpp",
"pressure/It_vfs_fat_mutipthread_021.cpp",
"pressure/It_vfs_fat_mutipthread_022.cpp",
"pressure/It_vfs_fat_mutipthread_023.cpp",
"pressure/It_vfs_fat_mutipthread_024.cpp",
"pressure/It_vfs_fat_mutipthread_027.cpp",
"pressure/It_vfs_fat_mutipthread_029.cpp",
"pressure/It_vfs_fat_mutipthread_030.cpp",
"pressure/It_vfs_fat_mutipthread_032.cpp",
"pressure/It_vfs_fat_mutipthread_033.cpp",
"pressure/It_vfs_fat_mutipthread_035.cpp",
"pressure/It_vfs_fat_mutipthread_036.cpp",
"pressure/It_vfs_fat_mutipthread_038.cpp",
"pressure/It_vfs_fat_mutipthread_039.cpp",
"pressure/It_vfs_fat_mutipthread_040.cpp",
"pressure/It_vfs_fat_mutipthread_041.cpp",
"pressure/It_vfs_fat_mutipthread_042.cpp",
"pressure/It_vfs_fat_mutipthread_043.cpp",
"pressure/It_vfs_fat_mutipthread_044.cpp",
"pressure/It_vfs_fat_mutipthread_045.cpp",
"pressure/It_vfs_fat_mutipthread_046.cpp",
"pressure/It_vfs_fat_mutipthread_047.cpp",
"pressure/It_vfs_fat_mutipthread_048.cpp",
"pressure/It_vfs_fat_mutipthread_049.cpp",
"pressure/It_vfs_fat_mutipthread_050.cpp",
]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
}
source_set("sources_other") {
sources = [
"//kernel/liteos_a/testsuites/unittest/common/osTest.cpp",
"VfsFatTest.cpp",
"full/It_vfs_fat_066.cpp",
"full/It_vfs_fat_068.cpp",
"full/It_vfs_fat_072.cpp",
@ -106,75 +193,36 @@ unittest("liteos_a_fs_vfat_unittest") {
"full/It_vfs_fat_903.cpp",
"full/It_vfs_fat_904.cpp",
"full/It_vfs_fat_909.cpp",
"pressure/It_fs_fat_performance_001.cpp",
"pressure/It_fs_fat_performance_002.cpp",
"pressure/It_fs_fat_performance_003.cpp",
"pressure/It_fs_fat_performance_004.cpp",
"pressure/It_fs_fat_performance_005.cpp",
"pressure/It_fs_fat_performance_006.cpp",
"pressure/It_fs_fat_performance_007.cpp",
"pressure/It_fs_fat_performance_008.cpp",
"pressure/It_fs_fat_performance_013.cpp",
"pressure/It_fs_fat_performance_014.cpp",
"pressure/It_fs_fat_performance_015.cpp",
"pressure/It_fs_fat_performance_016.cpp",
"pressure/It_fs_fat_pressure_029.cpp",
"pressure/It_fs_fat_pressure_030.cpp",
"pressure/It_fs_fat_pressure_031.cpp",
"pressure/It_fs_fat_pressure_038.cpp",
"pressure/It_fs_fat_pressure_040.cpp",
"pressure/It_fs_fat_pressure_041.cpp",
"pressure/It_fs_fat_pressure_042.cpp",
"pressure/It_fs_fat_pressure_301.cpp",
"pressure/It_fs_fat_pressure_302.cpp",
"pressure/It_fs_fat_pressure_303.cpp",
"pressure/It_fs_fat_pressure_305.cpp",
"pressure/It_fs_fat_pressure_306.cpp",
"pressure/It_fs_fat_pressure_309.cpp",
"pressure/It_vfs_fat_mutipthread_003.cpp",
"pressure/It_vfs_fat_mutipthread_004.cpp",
"pressure/It_vfs_fat_mutipthread_005.cpp",
"pressure/It_vfs_fat_mutipthread_006.cpp",
"pressure/It_vfs_fat_mutipthread_008.cpp",
"pressure/It_vfs_fat_mutipthread_009.cpp",
"pressure/It_vfs_fat_mutipthread_010.cpp",
"pressure/It_vfs_fat_mutipthread_012.cpp",
"pressure/It_vfs_fat_mutipthread_014.cpp",
"pressure/It_vfs_fat_mutipthread_016.cpp",
"pressure/It_vfs_fat_mutipthread_017.cpp",
"pressure/It_vfs_fat_mutipthread_018.cpp",
"pressure/It_vfs_fat_mutipthread_019.cpp",
"pressure/It_vfs_fat_mutipthread_020.cpp",
"pressure/It_vfs_fat_mutipthread_021.cpp",
"pressure/It_vfs_fat_mutipthread_022.cpp",
"pressure/It_vfs_fat_mutipthread_023.cpp",
"pressure/It_vfs_fat_mutipthread_024.cpp",
"pressure/It_vfs_fat_mutipthread_027.cpp",
"pressure/It_vfs_fat_mutipthread_029.cpp",
"pressure/It_vfs_fat_mutipthread_030.cpp",
"pressure/It_vfs_fat_mutipthread_032.cpp",
"pressure/It_vfs_fat_mutipthread_033.cpp",
"pressure/It_vfs_fat_mutipthread_035.cpp",
"pressure/It_vfs_fat_mutipthread_036.cpp",
"pressure/It_vfs_fat_mutipthread_038.cpp",
"pressure/It_vfs_fat_mutipthread_039.cpp",
"pressure/It_vfs_fat_mutipthread_040.cpp",
"pressure/It_vfs_fat_mutipthread_041.cpp",
"pressure/It_vfs_fat_mutipthread_042.cpp",
"pressure/It_vfs_fat_mutipthread_043.cpp",
"pressure/It_vfs_fat_mutipthread_044.cpp",
"pressure/It_vfs_fat_mutipthread_045.cpp",
"pressure/It_vfs_fat_mutipthread_046.cpp",
"pressure/It_vfs_fat_mutipthread_047.cpp",
"pressure/It_vfs_fat_mutipthread_048.cpp",
"pressure/It_vfs_fat_mutipthread_049.cpp",
"pressure/It_vfs_fat_mutipthread_050.cpp",
"smoke/It_vfs_fat_026.cpp",
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "//kernel/liteos_a/testsuites/unittest:public_config" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_fs_vfat_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
if (LOSCFG_USER_TEST_PRESSURE == true) {
deps += [ ":sources_pressure" ]
}
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_fs_vfat_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -28,21 +28,59 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../config.gni")
unittest("liteos_a_liteipc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../common/include",
"../liteipc",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../common/include",
"../liteipc",
]
sources_entry = [
"../common/osTest.cpp",
"smgr_demo.cpp",
"it_test_liteipc.cpp",
]
source_set("sources_smoke") {
sources = [
"../common/osTest.cpp",
"smoke/liteipc_test_001.cpp",
"smoke/liteipc_test_002.cpp",
"smgr_demo.cpp",
"it_test_liteipc.cpp",
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
configs = [ "..:public_config" ]
}
source_set("sources_other") {
sources = [
]
configs += [ "..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_liteipc_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_liteipc_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -28,33 +28,70 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/test.gni")
import("../../config.gni")
unittest("liteos_a_mem_shm_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = [
"../../common/include",
"../../mem/shm",
]
common_include_dirs = [
"//third_party/googletest/googletest/include",
"../../common/include",
"../../mem/shm",
]
sources_entry = [
"../../common/osTest.cpp",
"mem_shm_test.cpp",
]
source_set("sources_smoke") {
sources = [
"../../common/osTest.cpp",
"mem_shm_test.cpp",
"smoke/shm_test_001.cpp",
"smoke/shm_test_002.cpp",
"smoke/shm_test_003.cpp",
"smoke/shm_test_004.cpp",
"smoke/shm_test_005.cpp",
"smoke/shm_test_006.cpp",
"smoke/shm_test_007.cpp",
"smoke/shm_test_008.cpp",
"smoke/shm_test_009.cpp",
"smoke/shm_test_010.cpp",
"smoke/shm_test_011.cpp",
"smoke/shm_test_012.cpp",
"smoke/shm_test_013.cpp",
"smoke/shm_test_014.cpp",
# "smoke/it_test_mem_100.cpp",
"smoke/shm_test_001.cpp",
"smoke/shm_test_002.cpp",
"smoke/shm_test_003.cpp",
"smoke/shm_test_004.cpp",
"smoke/shm_test_005.cpp",
"smoke/shm_test_006.cpp",
"smoke/shm_test_007.cpp",
"smoke/shm_test_008.cpp",
"smoke/shm_test_009.cpp",
"smoke/shm_test_010.cpp",
"smoke/shm_test_011.cpp",
"smoke/shm_test_012.cpp",
"smoke/shm_test_013.cpp",
"smoke/shm_test_014.cpp",
]
configs = [ "../..:public_config" ]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
source_set("sources_other") {
sources = [
]
configs += [ "../..:local_public_config" ]
include_dirs = common_include_dirs
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
if (LOSCFG_USER_TEST_FOR_ALL == true) {
unittest("liteos_a_mem_shm_unittest") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_full" ]
deps = []
deps += [ ":sources_smoke" ]
deps += [ ":sources_other" ]
}
}
if (LOSCFG_USER_TEST_FOR_DOOR == true) {
unittest("liteos_a_mem_shm_unittest_door") {
output_extension = "bin"
output_dir = "$root_out_dir/test/unittest/kernel"
include_dirs = common_include_dirs
sources = sources_entry
configs = [ "../..:public_config_smk" ]
deps = []
deps += [ ":sources_smoke" ]
}
}

View File

@ -41,6 +41,7 @@ public:
static void TearDownTestCase(void) {}
};
#if defined(LOSCFG_USER_TEST_SMOKE)
/* *
* @tc.name: it_test_shm_001
* @tc.desc: function for MemShmTest
@ -91,10 +92,10 @@ HWTEST_F(MemShmTest, ItTestShm004, TestSize.Level0)
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
/*HWTEST_F(MemShmTest, ItTestShm005, TestSize.Level0)
HWTEST_F(MemShmTest, ItTestShm005, TestSize.Level0)
{
ItTestShm005(); // bug, errno
} */
ItTestShm005();
}
/* *
* @tc.name: it_test_shm_006
@ -161,6 +162,6 @@ HWTEST_F(MemShmTest, ItTestShm011, TestSize.Level0)
{
ItTestShm011();
}
#endif
}
// namespace OHOS

Some files were not shown because too many files have changed in this diff Show More