Commit 0dad2249 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan
Browse files

test-v2: Set up initial basic load test.

Manually pulling in Anton's upstream change for the test mods dir
macro.
parent 3511bec6
......@@ -39,6 +39,7 @@ LCD_DOMAINS_TOP_SRC_DIR=$(PWD)
export LCD_DOMAINS_TOP_SRC_DIR
export LCD_DOMAINS_CFLAGS=-Werror \
-DLCD_DOMAINS
-DLCD_TEST_MODS_PATH="$(PWD)/build/test_mods"
# Don't print "Entering directory..." etc.
MAKEFLAGS += --no-print-directory
......@@ -191,7 +192,8 @@ test_mods: $(TEST_MODULES_BUILD_KBUILDS) $(TEST_MODULES_BUILD_DIRS) | \
$(LCD_TEST_MODULES_BUILD_DIR)/%/Kbuild: $(LCD_TEST_MODULES_DIR)/%/Kbuild | \
$(TEST_MODULES_BUILD_DIRS)
@echo " KBUILD $^"
@printf "#\n# BEGIN: Auto-generated part. ('src =' line auto-generated).\n#\n\n" > $@ && \
@printf "#\n# BEGIN: Auto-generated part.\n#\n\n" > $@ && \
printf "LIBLCD =
printf "src = $(shell dirname `readlink -f $^`)\n\n" >> $@ && \
printf "#\n# END: Auto-generated part.\n#\n\n" >> $@ && \
cat $^ >> $@
......
......@@ -98,8 +98,6 @@ enum lcd_xmit_status {
LCD_XMIT_FAILED = 2, /* when send/recv failed */
};
#define LCD_CONSOLE_BUFF_SIZE 512
struct lcd {
/*
* Lock
......
......@@ -344,6 +344,7 @@ struct lcd_boot_info {
*/
#define LCD_MPATH_SIZE 256
/* LCD_TEST_MODS_PATH set in top-level Makefile via -D */
#define LCD_DIR(subpath) \
LCD_TEST_MODS_PATH "/" subpath
......
......@@ -26,11 +26,11 @@ int __lcd_put_char(struct lcd *lcd, char c)
lcd->console_cursor = 0;
return 0;
}
if (lcd->console_cursor >= LCD_CONSOLE_BUFF_SIZE - 1) {
if (lcd->console_cursor >= LCD_PRINTK_BUFF_SIZE - 1) {
/*
* Filled buffer; empty it.
*/
lcd->console_buff[LCD_CONSOLE_BUFF_SIZE - 1] = 0;
lcd->console_buff[LCD_PRINTK_BUFF_SIZE - 1] = 0;
printk(KERN_INFO "(incomplete) message from lcd %p: %s\n",
lcd, lcd->console_buff);
lcd->console_cursor = 0;
......
......@@ -2,4 +2,7 @@
# Top-level test mods Kbuild file
#
export ISOLATED_CC_FLAGS=-I$(LCD_DOMAINS_TOP_SRC_DIR)/lcd_config/isolated
export NON_ISOLATED_CC_FLAGS= # empty for now
obj-m += liblcd_test/
# hello
\ No newline at end of file
obj-m += lcd_test_mod_liblcd_tests_boot.o
lcd_test_mod_liblcd_tests_boot-y += boot.o
ccflags-y += $(NON_ISOLATED_CC_FLAGS)
\ No newline at end of file
/*
* boot.c - non-isolated boot module
*/
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <liblcd/liblcd.h>
static int boot_main(void)
{
int ret;
cptr_t lcd;
struct lcd_create_ctx *ctx;
/*
* Enter LCD mode
*/
ret = lcd_enter();
if (ret) {
LIBLCD_ERR("lcd enter failed");
goto fail1;
}
/*
* Create lcd
*/
ret = lcd_create_module_lcd(&lcd,
LCD_DIR("liblcd_tests/lcd"),
"lcd_test_mod_liblcd_tests_lcd",
&ctx);
if (ret) {
LIBLCD_ERR("failed to create lcd");
goto fail2;
}
/*
* Run lcd
*/
ret = lcd_run(lcd);
if (ret) {
LIBLCD_ERR("failed to start lcd");
goto fail3;
}
/*
* Hang out for four seconds
*/
msleep(4000);
/*
* Tear everything down
*/
ret = 0;
goto out;
/*
* Everything torn down / freed during destroy / exit.
*/
out:
fail3:
lcd_cap_delete(lcd);
lcd_destroy_create_ctx(ctx);
fail2:
lcd_exit(0);
fail1:
return ret;
}
static void boot_exit(void)
{
/* nothing to do */
}
module_init(boot_main);
module_exit(boot_exit);
obj-m += lcd_test_mod_liblcd_tests_lcd.o
lcd_test_mod_liblcd_tests_lcd-y += lcd.o
lcd_test_mod_liblcd_tests_lcd-y += $(LIBLCD)
ccflags-y += $(ISOLATED_CC_FLAGS)
\ No newline at end of file
/*
* lcd.c - code for isolated LCD in liblcd test
*/
#include <lcd_config/pre_hook.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <liblcd/liblcd.h>
#include <lcd_config/post_hook.h>
static int __noreturn __init liblcd_test_lcd_init(void)
{
int r = 0;
r = lcd_enter();
goto out;
out:
lcd_exit(r);
}
static void liblcd_test_lcd_exit(void)
{
return;
}
module_init(liblcd_test_lcd_init);
module_exit(liblcd_test_lcd_exit);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment