linux-kselftest-4.11-rc1

This update consists of:
 
 -- fixes to several existing tests from Stafford Horne
 -- cpufreq tests from Viresh Kumar
 -- Selftest build and install fixes from Bamvor Jian Zhang
    and Michael Ellerman
 -- Fixes to protection-keys tests from Dave Hansen
 -- Warning fixes from Shuah Khan
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJYsJgxAAoJEAsCRMQNDUMcNCUQALy+jVZV3U1yypLCQinlgbdH
 rlh7oKIpGfWGXNe1BQVLS5S+bjil9XDdty+4VOB7x9gfQ6fvea3w0IQhI5CyONmm
 hZg/miheZzN5ujqKjfuUQrHzEbEAs+CH0A0sVH+ueptw37roTWhf1ZCSpQBpas5p
 XMZrfBI0mQLd9Z3D0G5TSsVjSPcMhKeoYDMGPMCulZuamVMY40XkPcvaYe1Zg1Mj
 7nD7Aw6JxxV0tlZwo0n540w8tdx/yQ+49jqhulozCQNL+KmXO8FlM/Jnu1b24/YW
 hlu5dvLmi9rAHYEHwqFf5yqZci/50Q+LHuxcxEp3RLxRW+KXJP7c53Kn8eutIwqH
 HR03TSA1TRv9b4MvWJs/ULF/EYYtTPUDSinAtNMf4iegXp0BbT7P0eOibF1vj3tz
 bcfPB5vi1SxQqLQwCPomUzhlPB4muBu9lHjZ2tI5EKynXXZxN33zugHYqBY0zNPm
 7dS+4iXs/phEDlW0j+3BhHQz2of+Q6fSOC/jvgAYGdmqh1aNHl9WpIWfFubuBQhd
 fkKJmgpJ1Mk5mBG/dGdCGTryv38tzFLr+n4MJWthfya84cbvk1W0HQQjwmROrIiP
 qxC4F1Da6F88mfrpFDKW9LxAwfJFCgSxnYFygRsyzZK/VKdm2CI8yeoY2rt2lyRF
 jUdxx7SJ7+71sO1xWcAE
 =F3yO
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest update from Shuah Khan:
 "This update consists of:

   - fixes to several existing tests from Stafford Horne

   - cpufreq tests from Viresh Kumar

   - Selftest build and install fixes from Bamvor Jian Zhang and Michael
     Ellerman

   - Fixes to protection-keys tests from Dave Hansen

   - Warning fixes from Shuah Khan"

* tag 'linux-kselftest-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (28 commits)
  selftests/powerpc: Fix remaining fallout from recent changes
  selftests/powerpc: Fix the clean rule since recent changes
  selftests: Fix the .S and .S -> .o rules
  selftests: Fix the .c linking rule
  selftests: Fix selftests build to just build, not run tests
  selftests, x86, protection_keys: fix wrong offset in siginfo
  selftests, x86, protection_keys: fix uninitialized variable warning
  selftest: cpufreq: Update MAINTAINERS file
  selftest: cpufreq: Add special tests
  selftest: cpufreq: Add support to test cpufreq modules
  selftest: cpufreq: Add suspend/resume/hibernate support
  selftest: cpufreq: Add support for cpufreq tests
  selftests: Add intel_pstate to TARGETS
  selftests/intel_pstate: Update makefile to match new style
  selftests/intel_pstate: Fix warning on loop index overflow
  cpupower: Restore format of frequency-info limit
  selftests/futex: Add headers to makefile dependencies
  selftests/futex: Add stdio used for logging
  selftests: x86 protection_keys remove dead code
  selftests: x86 protection_keys fix unused variable compile warnings
  ...
This commit is contained in:
Linus Torvalds 2017-02-25 15:32:53 -08:00
commit c4f3f22edd
59 changed files with 1342 additions and 419 deletions

View File

@ -95,3 +95,15 @@ In general, the rules for selftests are
* Don't cause the top-level "make run_tests" to fail if your feature is
unconfigured.
Contributing new tests(details)
===============================
* Use TEST_GEN_XXX if such binaries or files are generated during
compiling.
TEST_PROGS, TEST_GEN_PROGS mean it is the excutable tested by
default.
TEST_PROGS_EXTENDED, TEST_GEN_PROGS_EXTENDED mean it is the
executable which is not tested by default.
TEST_FILES, TEST_GEN_FILES mean it is the file which is used by
test.

View File

@ -3452,6 +3452,7 @@ B: https://bugzilla.kernel.org
F: Documentation/cpu-freq/
F: drivers/cpufreq/
F: include/linux/cpufreq.h
F: tools/testing/selftests/cpufreq/
CPU FREQUENCY DRIVERS - ARM BIG LITTLE
M: Viresh Kumar <viresh.kumar@linaro.org>

View File

@ -285,20 +285,24 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
/* --hwlimits / -l */
static int get_hardware_limits(unsigned int cpu)
static int get_hardware_limits(unsigned int cpu, unsigned int human)
{
unsigned long min, max;
printf(_(" hardware limits: "));
if (cpufreq_get_hardware_limits(cpu, &min, &max)) {
printf(_("Not Available\n"));
return -EINVAL;
}
print_speed(min);
printf(" - ");
print_speed(max);
printf("\n");
if (human) {
printf(_(" hardware limits: "));
print_speed(min);
printf(" - ");
print_speed(max);
printf("\n");
} else {
printf("%lu %lu\n", min, max);
}
return 0;
}
@ -456,7 +460,7 @@ static void debug_output_one(unsigned int cpu)
get_related_cpus(cpu);
get_affected_cpus(cpu);
get_latency(cpu, 1);
get_hardware_limits(cpu);
get_hardware_limits(cpu, 1);
freqs = cpufreq_get_available_frequencies(cpu);
if (freqs) {
@ -622,7 +626,7 @@ int cmd_freq_info(int argc, char **argv)
ret = get_driver(cpu);
break;
case 'l':
ret = get_hardware_limits(cpu);
ret = get_hardware_limits(cpu, human);
break;
case 'w':
ret = get_freq_hardware(cpu, human);
@ -639,7 +643,6 @@ int cmd_freq_info(int argc, char **argv)
}
if (ret)
return ret;
printf("\n");
}
return ret;
}

View File

@ -1,6 +1,7 @@
TARGETS = bpf
TARGETS += breakpoints
TARGETS += capabilities
TARGETS += cpufreq
TARGETS += cpu-hotplug
TARGETS += efivarfs
TARGETS += exec
@ -8,6 +9,7 @@ TARGETS += firmware
TARGETS += ftrace
TARGETS += futex
TARGETS += gpio
TARGETS += intel_pstate
TARGETS += ipc
TARGETS += kcmp
TARGETS += lib
@ -49,29 +51,44 @@ override LDFLAGS =
override MAKEFLAGS =
endif
BUILD := $(O)
ifndef BUILD
BUILD := $(KBUILD_OUTPUT)
endif
ifndef BUILD
BUILD := $(shell pwd)
endif
export BUILD
all:
for TARGET in $(TARGETS); do \
make -C $$TARGET; \
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
done;
run_tests: all
for TARGET in $(TARGETS); do \
make -C $$TARGET run_tests; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
done;
hotplug:
for TARGET in $(TARGETS_HOTPLUG); do \
make -C $$TARGET; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
done;
run_hotplug: hotplug
for TARGET in $(TARGETS_HOTPLUG); do \
make -C $$TARGET run_full_test; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
done;
clean_hotplug:
for TARGET in $(TARGETS_HOTPLUG); do \
make -C $$TARGET clean; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
run_pstore_crash:
@ -86,7 +103,8 @@ ifdef INSTALL_PATH
@# Ask all targets to install their files
mkdir -p $(INSTALL_PATH)
for TARGET in $(TARGETS); do \
make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
done;
@# Ask all targets to emit their test scripts
@ -95,10 +113,11 @@ ifdef INSTALL_PATH
echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
echo "echo ========================================" >> $(ALL_SCRIPT); \
echo "cd $$TARGET" >> $(ALL_SCRIPT); \
make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
done;
@ -109,7 +128,8 @@ endif
clean:
for TARGET in $(TARGETS); do \
make -C $$TARGET clean; \
BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
.PHONY: install

View File

@ -3,15 +3,12 @@ BPFOBJ := $(LIBDIR)/bpf/bpf.o
CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR)
test_objs = test_verifier test_tag test_maps test_lru_map test_lpm_map
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map
TEST_PROGS := $(test_objs) test_kmod.sh
TEST_FILES := $(test_objs)
TEST_PROGS := test_kmod.sh
.PHONY: all clean force
all: $(test_objs)
# force a rebuild of BPFOBJ when its dependencies are updated
force:
@ -21,6 +18,3 @@ $(BPFOBJ): force
$(test_objs): $(BPFOBJ)
include ../lib.mk
clean:
$(RM) $(test_objs)

View File

@ -3,17 +3,13 @@ uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_PROGS := breakpoint_test
TEST_GEN_PROGS := breakpoint_test
endif
ifeq ($(ARCH),aarch64)
TEST_PROGS := breakpoint_test_arm64
TEST_GEN_PROGS := breakpoint_test_arm64
endif
TEST_PROGS += step_after_suspend_test
all: $(TEST_PROGS)
TEST_GEN_PROGS += step_after_suspend_test
include ../lib.mk
clean:
rm -fr breakpoint_test breakpoint_test_arm64 step_after_suspend_test

View File

@ -1,15 +1,8 @@
TEST_FILES := validate_cap
TEST_PROGS := test_execve
BINARIES := $(TEST_FILES) $(TEST_PROGS)
TEST_GEN_FILES := validate_cap
TEST_GEN_PROGS := test_execve
CFLAGS += -O2 -g -std=gnu99 -Wall
LDLIBS += -lcap-ng -lrt -ldl
all: $(BINARIES)
clean:
$(RM) $(BINARIES)
include ../lib.mk

View File

@ -0,0 +1,8 @@
all:
TEST_PROGS := main.sh
TEST_FILES := cpu.sh cpufreq.sh governor.sh module.sh special-tests.sh
include ../lib.mk
clean:

View File

@ -0,0 +1,84 @@
#!/bin/bash
#
# CPU helpers
# protect against multiple inclusion
if [ $FILE_CPU ]; then
return 0
else
FILE_CPU=DONE
fi
source cpufreq.sh
for_each_cpu()
{
cpus=$(ls $CPUROOT | grep "cpu[0-9].*")
for cpu in $cpus; do
$@ $cpu
done
}
for_each_non_boot_cpu()
{
cpus=$(ls $CPUROOT | grep "cpu[1-9].*")
for cpu in $cpus; do
$@ $cpu
done
}
#$1: cpu
offline_cpu()
{
printf "Offline $1\n"
echo 0 > $CPUROOT/$1/online
}
#$1: cpu
online_cpu()
{
printf "Online $1\n"
echo 1 > $CPUROOT/$1/online
}
#$1: cpu
reboot_cpu()
{
offline_cpu $1
online_cpu $1
}
# Reboot CPUs
# param: number of times we want to run the loop
reboot_cpus()
{
printf "** Test: Running ${FUNCNAME[0]} for $1 loops **\n\n"
for i in `seq 1 $1`; do
for_each_non_boot_cpu offline_cpu
for_each_non_boot_cpu online_cpu
printf "\n"
done
printf "\n%s\n\n" "------------------------------------------------"
}
# Prints warning for all CPUs with missing cpufreq directory
print_unmanaged_cpus()
{
for_each_cpu cpu_should_have_cpufreq_directory
}
# Counts CPUs with cpufreq directories
count_cpufreq_managed_cpus()
{
count=0;
for cpu in `ls $CPUROOT | grep "cpu[0-9].*"`; do
if [ -d $CPUROOT/$cpu/cpufreq ]; then
let count=count+1;
fi
done
echo $count;
}

View File

@ -0,0 +1,241 @@
#!/bin/bash
# protect against multiple inclusion
if [ $FILE_CPUFREQ ]; then
return 0
else
FILE_CPUFREQ=DONE
fi
source cpu.sh
# $1: cpu
cpu_should_have_cpufreq_directory()
{
if [ ! -d $CPUROOT/$1/cpufreq ]; then
printf "Warning: No cpufreq directory present for $1\n"
fi
}
cpu_should_not_have_cpufreq_directory()
{
if [ -d $CPUROOT/$1/cpufreq ]; then
printf "Warning: cpufreq directory present for $1\n"
fi
}
for_each_policy()
{
policies=$(ls $CPUFREQROOT| grep "policy[0-9].*")
for policy in $policies; do
$@ $policy
done
}
for_each_policy_concurrent()
{
policies=$(ls $CPUFREQROOT| grep "policy[0-9].*")
for policy in $policies; do
$@ $policy &
done
}
# $1: Path
read_cpufreq_files_in_dir()
{
local files=`ls $1`
printf "Printing directory: $1\n\n"
for file in $files; do
if [ -f $1/$file ]; then
printf "$file:"
cat $1/$file
else
printf "\n"
read_cpufreq_files_in_dir "$1/$file"
fi
done
printf "\n"
}
read_all_cpufreq_files()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
read_cpufreq_files_in_dir $CPUFREQROOT
printf "%s\n\n" "------------------------------------------------"
}
# UPDATE CPUFREQ FILES
# $1: directory path
update_cpufreq_files_in_dir()
{
local files=`ls $1`
printf "Updating directory: $1\n\n"
for file in $files; do
if [ -f $1/$file ]; then
# file is writable ?
local wfile=$(ls -l $1/$file | awk '$1 ~ /^.*w.*/ { print $NF; }')
if [ ! -z $wfile ]; then
# scaling_setspeed is a special file and we
# should skip updating it
if [ $file != "scaling_setspeed" ]; then
local val=$(cat $1/$file)
printf "Writing $val to: $file\n"
echo $val > $1/$file
fi
fi
else
printf "\n"
update_cpufreq_files_in_dir "$1/$file"
fi
done
printf "\n"
}
# Update all writable files with their existing values
update_all_cpufreq_files()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
update_cpufreq_files_in_dir $CPUFREQROOT
printf "%s\n\n" "------------------------------------------------"
}
# CHANGE CPU FREQUENCIES
# $1: policy
find_current_freq()
{
cat $CPUFREQROOT/$1/scaling_cur_freq
}
# $1: policy
# $2: frequency
set_cpu_frequency()
{
printf "Change frequency for $1 to $2\n"
echo $2 > $CPUFREQROOT/$1/scaling_setspeed
}
# $1: policy
test_all_frequencies()
{
local filepath="$CPUFREQROOT/$1"
backup_governor $1
local found=$(switch_governor $1 "userspace")
if [ $found = 1 ]; then
printf "${FUNCNAME[0]}: userspace governor not available for: $1\n"
return;
fi
printf "Switched governor for $1 to userspace\n\n"
local freqs=$(cat $filepath/scaling_available_frequencies)
printf "Available frequencies for $1: $freqs\n\n"
# Set all frequencies one-by-one
for freq in $freqs; do
set_cpu_frequency $1 $freq
done
printf "\n"
restore_governor $1
}
# $1: loop count
shuffle_frequency_for_all_cpus()
{
printf "** Test: Running ${FUNCNAME[0]} for $1 loops **\n\n"
for i in `seq 1 $1`; do
for_each_policy test_all_frequencies
done
printf "\n%s\n\n" "------------------------------------------------"
}
# Basic cpufreq tests
cpufreq_basic_tests()
{
printf "*** RUNNING CPUFREQ SANITY TESTS ***\n"
printf "====================================\n\n"
count=$(count_cpufreq_managed_cpus)
if [ $count = 0 ]; then
printf "No cpu is managed by cpufreq core, exiting\n"
exit;
else
printf "CPUFreq manages: $count CPUs\n\n"
fi
# Detect & print which CPUs are not managed by cpufreq
print_unmanaged_cpus
# read/update all cpufreq files
read_all_cpufreq_files
update_all_cpufreq_files
# hotplug cpus
reboot_cpus 5
# Test all frequencies
shuffle_frequency_for_all_cpus 2
# Test all governors
shuffle_governors_for_all_cpus 1
}
# Suspend/resume
# $1: "suspend" or "hibernate", $2: loop count
do_suspend()
{
printf "** Test: Running ${FUNCNAME[0]}: Trying $1 for $2 loops **\n\n"
# Is the directory available
if [ ! -d $SYSFS/power/ -o ! -f $SYSFS/power/state ]; then
printf "$SYSFS/power/state not available\n"
return 1
fi
if [ $1 = "suspend" ]; then
filename="mem"
elif [ $1 = "hibernate" ]; then
filename="disk"
else
printf "$1 is not a valid option\n"
return 1
fi
if [ -n $filename ]; then
present=$(cat $SYSFS/power/state | grep $filename)
if [ -z "$present" ]; then
printf "Tried to $1 but $filename isn't present in $SYSFS/power/state\n"
return 1;
fi
for i in `seq 1 $2`; do
printf "Starting $1\n"
echo $filename > $SYSFS/power/state
printf "Came out of $1\n"
printf "Do basic tests after finishing $1 to verify cpufreq state\n\n"
cpufreq_basic_tests
done
fi
}

View File

@ -0,0 +1,153 @@
#!/bin/bash
#
# Test governors
# protect against multiple inclusion
if [ $FILE_GOVERNOR ]; then
return 0
else
FILE_GOVERNOR=DONE
fi
source cpu.sh
source cpufreq.sh
CUR_GOV=
CUR_FREQ=
# Find governor's directory path
# $1: policy, $2: governor
find_gov_directory()
{
if [ -d $CPUFREQROOT/$2 ]; then
printf "$CPUFREQROOT/$2\n"
elif [ -d $CPUFREQROOT/$1/$2 ]; then
printf "$CPUFREQROOT/$1/$2\n"
else
printf "INVALID\n"
fi
}
# $1: policy
find_current_governor()
{
cat $CPUFREQROOT/$1/scaling_governor
}
# $1: policy
backup_governor()
{
CUR_GOV=$(find_current_governor $1)
printf "Governor backup done for $1: $CUR_GOV\n"
if [ $CUR_GOV == "userspace" ]; then
CUR_FREQ=$(find_current_freq $1)
printf "Governor frequency backup done for $1: $CUR_FREQ\n"
fi
printf "\n"
}
# $1: policy
restore_governor()
{
__switch_governor $1 $CUR_GOV
printf "Governor restored for $1 to $CUR_GOV\n"
if [ $CUR_GOV == "userspace" ]; then
set_cpu_frequency $1 $CUR_FREQ
printf "Governor frequency restored for $1: $CUR_FREQ\n"
fi
printf "\n"
}
# param:
# $1: policy, $2: governor
__switch_governor()
{
echo $2 > $CPUFREQROOT/$1/scaling_governor
}
# param:
# $1: cpu, $2: governor
__switch_governor_for_cpu()
{
echo $2 > $CPUROOT/$1/cpufreq/scaling_governor
}
# SWITCH GOVERNORS
# $1: cpu, $2: governor
switch_governor()
{
local filepath=$CPUFREQROOT/$1/scaling_available_governors
# check if governor is available
local found=$(cat $filepath | grep $2 | wc -l)
if [ $found = 0 ]; then
echo 1;
return
fi
__switch_governor $1 $2
echo 0;
}
# $1: policy, $2: governor
switch_show_governor()
{
cur_gov=find_current_governor
if [ $cur_gov == "userspace" ]; then
cur_freq=find_current_freq
fi
# switch governor
__switch_governor $1 $2
printf "\nSwitched governor for $1 to $2\n\n"
if [ $2 == "userspace" -o $2 == "powersave" -o $2 == "performance" ]; then
printf "No files to read for $2 governor\n\n"
return
fi
# show governor files
local govpath=$(find_gov_directory $1 $2)
read_cpufreq_files_in_dir $govpath
}
# $1: function to be called, $2: policy
call_for_each_governor()
{
local filepath=$CPUFREQROOT/$2/scaling_available_governors
# Exit if cpu isn't managed by cpufreq core
if [ ! -f $filepath ]; then
return;
fi
backup_governor $2
local governors=$(cat $filepath)
printf "Available governors for $2: $governors\n"
for governor in $governors; do
$1 $2 $governor
done
restore_governor $2
}
# $1: loop count
shuffle_governors_for_all_cpus()
{
printf "** Test: Running ${FUNCNAME[0]} for $1 loops **\n\n"
for i in `seq 1 $1`; do
for_each_policy call_for_each_governor switch_show_governor
done
printf "%s\n\n" "------------------------------------------------"
}

View File

@ -0,0 +1,194 @@
#!/bin/bash
source cpu.sh
source cpufreq.sh
source governor.sh
source module.sh
source special-tests.sh
FUNC=basic # do basic tests by default
OUTFILE=cpufreq_selftest
SYSFS=
CPUROOT=
CPUFREQROOT=
helpme()
{
printf "Usage: $0 [-h] [-todg args]
[-h <help>]
[-o <output-file-for-dump>]
[-t <basic: Basic cpufreq testing
suspend: suspend/resume,
hibernate: hibernate/resume,
modtest: test driver or governor modules. Only to be used with -d or -g options,
sptest1: Simple governor switch to produce lockdep.
sptest2: Concurrent governor switch to produce lockdep.
sptest3: Governor races, shuffle between governors quickly.
sptest4: CPU hotplugs with updates to cpufreq files.>]
[-d <driver's module name: only with \"-t modtest>\"]
[-g <governor's module name: only with \"-t modtest>\"]
\n"
exit 2
}
prerequisite()
{
msg="skip all tests:"
if [ $UID != 0 ]; then
echo $msg must be run as root >&2
exit 2
fi
taskset -p 01 $$
SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'`
if [ ! -d "$SYSFS" ]; then
echo $msg sysfs is not mounted >&2
exit 2
fi
CPUROOT=$SYSFS/devices/system/cpu
CPUFREQROOT="$CPUROOT/cpufreq"
if ! ls $CPUROOT/cpu* > /dev/null 2>&1; then
echo $msg cpus not available in sysfs >&2
exit 2
fi
if ! ls $CPUROOT/cpufreq > /dev/null 2>&1; then
echo $msg cpufreq directory not available in sysfs >&2
exit 2
fi
}
parse_arguments()
{
while getopts ht:o:d:g: arg
do
case $arg in
h) # --help
helpme
;;
t) # --func_type (Function to perform: basic, suspend, hibernate, modtest, sptest1/2/3/4 (default: basic))
FUNC=$OPTARG
;;
o) # --output-file (Output file to store dumps)
OUTFILE=$OPTARG
;;
d) # --driver-mod-name (Name of the driver module)
DRIVER_MOD=$OPTARG
;;
g) # --governor-mod-name (Name of the governor module)
GOVERNOR_MOD=$OPTARG
;;
\?)
helpme
;;
esac
done
}
do_test()
{
# Check if CPUs are managed by cpufreq or not
count=$(count_cpufreq_managed_cpus)
if [ $count = 0 -a $FUNC != "modtest" ]; then
echo "No cpu is managed by cpufreq core, exiting"
exit 2;
fi
case "$FUNC" in
"basic")
cpufreq_basic_tests
;;
"suspend")
do_suspend "suspend" 1
;;
"hibernate")
do_suspend "hibernate" 1
;;
"modtest")
# Do we have modules in place?
if [ -z $DRIVER_MOD ] && [ -z $GOVERNOR_MOD ]; then
echo "No driver or governor module passed with -d or -g"
exit 2;
fi
if [ $DRIVER_MOD ]; then
if [ $GOVERNOR_MOD ]; then
module_test $DRIVER_MOD $GOVERNOR_MOD
else
module_driver_test $DRIVER_MOD
fi
else
if [ $count = 0 ]; then
echo "No cpu is managed by cpufreq core, exiting"
exit 2;
fi
module_governor_test $GOVERNOR_MOD
fi
;;
"sptest1")
simple_lockdep
;;
"sptest2")
concurrent_lockdep
;;
"sptest3")
governor_race
;;
"sptest4")
hotplug_with_updates
;;
*)
echo "Invalid [-f] function type"
helpme
;;
esac
}
# clear dumps
# $1: file name
clear_dumps()
{
echo "" > $1.txt
echo "" > $1.dmesg_cpufreq.txt
echo "" > $1.dmesg_full.txt
}
# $1: output file name
dmesg_dumps()
{
dmesg | grep cpufreq >> $1.dmesg_cpufreq.txt
# We may need the full logs as well
dmesg >> $1.dmesg_full.txt
}
# Parse arguments
parse_arguments $@
# Make sure all requirements are met
prerequisite
# Run requested functions
clear_dumps $OUTFILE
do_test >> $OUTFILE.txt
dmesg_dumps $OUTFILE

View File

@ -0,0 +1,243 @@
#!/bin/bash
#
# Modules specific tests cases
# protect against multiple inclusion
if [ $FILE_MODULE ]; then
return 0
else
FILE_MODULE=DONE
fi
source cpu.sh
source cpufreq.sh
source governor.sh
# Check basic insmod/rmmod
# $1: module
test_basic_insmod_rmmod()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
printf "Inserting $1 module\n"
# insert module
insmod $1
if [ $? != 0 ]; then
printf "Insmod $1 failed\n"
exit;
fi
printf "Removing $1 module\n"
# remove module
rmmod $1
if [ $? != 0 ]; then
printf "rmmod $1 failed\n"
exit;
fi
printf "\n"
}
# Insert cpufreq driver module and perform basic tests
# $1: cpufreq-driver module to insert
# $2: If we want to play with CPUs (1) or not (0)
module_driver_test_single()
{
printf "** Test: Running ${FUNCNAME[0]} for driver $1 and cpus_hotplug=$2 **\n\n"
if [ $2 -eq 1 ]; then
# offline all non-boot CPUs
for_each_non_boot_cpu offline_cpu
printf "\n"
fi
# insert module
printf "Inserting $1 module\n\n"
insmod $1
if [ $? != 0 ]; then
printf "Insmod $1 failed\n"
return;
fi
if [ $2 -eq 1 ]; then
# online all non-boot CPUs
for_each_non_boot_cpu online_cpu
printf "\n"
fi
# run basic tests
cpufreq_basic_tests
# remove module
printf "Removing $1 module\n\n"
rmmod $1
if [ $? != 0 ]; then
printf "rmmod $1 failed\n"
return;
fi
# There shouldn't be any cpufreq directories now.
for_each_cpu cpu_should_not_have_cpufreq_directory
printf "\n"
}
# $1: cpufreq-driver module to insert
module_driver_test()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
# check if module is present or not
ls $1 > /dev/null
if [ $? != 0 ]; then
printf "$1: not present in `pwd` folder\n"
return;
fi
# test basic module tests
test_basic_insmod_rmmod $1
# Do simple module test
module_driver_test_single $1 0
# Remove CPUs before inserting module and then bring them back
module_driver_test_single $1 1
printf "\n"
}
# find governor name based on governor module name
# $1: governor module name
find_gov_name()
{
if [ $1 = "cpufreq_ondemand.ko" ]; then
printf "ondemand"
elif [ $1 = "cpufreq_conservative.ko" ]; then
printf "conservative"
elif [ $1 = "cpufreq_userspace.ko" ]; then
printf "userspace"
elif [ $1 = "cpufreq_performance.ko" ]; then
printf "performance"
elif [ $1 = "cpufreq_powersave.ko" ]; then
printf "powersave"
elif [ $1 = "cpufreq_schedutil.ko" ]; then
printf "schedutil"
fi
}
# $1: governor string, $2: governor module, $3: policy
# example: module_governor_test_single "ondemand" "cpufreq_ondemand.ko" 2
module_governor_test_single()
{
printf "** Test: Running ${FUNCNAME[0]} for $3 **\n\n"
backup_governor $3
# switch to new governor
printf "Switch from $CUR_GOV to $1\n"
switch_show_governor $3 $1
# try removing module, it should fail as governor is used
printf "Removing $2 module\n\n"
rmmod $2
if [ $? = 0 ]; then
printf "WARN: rmmod $2 succeeded even if governor is used\n"
insmod $2
else
printf "Pass: unable to remove $2 while it is being used\n\n"
fi
# switch back to old governor
printf "Switchback to $CUR_GOV from $1\n"
restore_governor $3
printf "\n"
}
# Insert cpufreq governor module and perform basic tests
# $1: cpufreq-governor module to insert
module_governor_test()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
# check if module is present or not
ls $1 > /dev/null
if [ $? != 0 ]; then
printf "$1: not present in `pwd` folder\n"
return;
fi
# test basic module tests
test_basic_insmod_rmmod $1
# insert module
printf "Inserting $1 module\n\n"
insmod $1
if [ $? != 0 ]; then
printf "Insmod $1 failed\n"
return;
fi
# switch to new governor for each cpu
for_each_policy module_governor_test_single $(find_gov_name $1) $1
# remove module
printf "Removing $1 module\n\n"
rmmod $1
if [ $? != 0 ]; then
printf "rmmod $1 failed\n"
return;
fi
printf "\n"
}
# test modules: driver and governor
# $1: driver module, $2: governor module
module_test()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
# check if modules are present or not
ls $1 $2 > /dev/null
if [ $? != 0 ]; then
printf "$1 or $2: is not present in `pwd` folder\n"
return;
fi
# TEST1: Insert gov after driver
# insert driver module
printf "Inserting $1 module\n\n"
insmod $1
if [ $? != 0 ]; then
printf "Insmod $1 failed\n"
return;
fi
# run governor tests
module_governor_test $2
# remove driver module
printf "Removing $1 module\n\n"
rmmod $1
if [ $? != 0 ]; then
printf "rmmod $1 failed\n"
return;
fi
# TEST2: Insert driver after governor
# insert governor module
printf "Inserting $2 module\n\n"
insmod $2
if [ $? != 0 ]; then
printf "Insmod $2 failed\n"
return;
fi
# run governor tests
module_driver_test $1
# remove driver module
printf "Removing $2 module\n\n"
rmmod $2
if [ $? != 0 ]; then
printf "rmmod $2 failed\n"
return;
fi
}

View File

@ -0,0 +1,115 @@
#!/bin/bash
#
# Special test cases reported by people
# Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=2
# protect against multiple inclusion
if [ $FILE_SPECIAL ]; then
return 0
else
FILE_SPECIAL=DONE
fi
source cpu.sh
source cpufreq.sh
source governor.sh
# Test 1
# $1: policy
__simple_lockdep()
{
# switch to ondemand
__switch_governor $1 "ondemand"
# cat ondemand files
local ondir=$(find_gov_directory $1 "ondemand")
if [ -z $ondir ]; then
printf "${FUNCNAME[0]}Ondemand directory not created, quit"
return
fi
cat $ondir/*
# switch to conservative
__switch_governor $1 "conservative"
}
simple_lockdep()
{
printf "** Test: Running ${FUNCNAME[0]} **\n"
for_each_policy __simple_lockdep
}
# Test 2
# $1: policy
__concurrent_lockdep()
{
for i in `seq 0 100`; do
__simple_lockdep $1
done
}
concurrent_lockdep()
{
printf "** Test: Running ${FUNCNAME[0]} **\n"
for_each_policy_concurrent __concurrent_lockdep
}
# Test 3
quick_shuffle()
{
# this is called concurrently from governor_race
for I in `seq 1000`
do
echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &
echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &
done
}
governor_race()
{
printf "** Test: Running ${FUNCNAME[0]} **\n"
# run 8 concurrent instances
for I in `seq 8`
do
quick_shuffle &
done
}
# Test 4
# $1: cpu
hotplug_with_updates_cpu()
{
local filepath="$CPUROOT/$1/cpufreq"
# switch to ondemand
__switch_governor_for_cpu $1 "ondemand"
for i in `seq 1 5000`
do
reboot_cpu $1
done &
local freqs=$(cat $filepath/scaling_available_frequencies)
local oldfreq=$(cat $filepath/scaling_min_freq)
for j in `seq 1 5000`
do
# Set all frequencies one-by-one
for freq in $freqs; do
echo $freq > $filepath/scaling_min_freq
done
done
# restore old freq
echo $oldfreq > $filepath/scaling_min_freq
}
hotplug_with_updates()
{
for_each_non_boot_cpu hotplug_with_updates_cpu
}

View File

@ -1,13 +1,7 @@
CFLAGS = -Wall
test_objs = open-unlink create-read
all: $(test_objs)
TEST_GEN_FILES := open-unlink create-read
TEST_PROGS := efivarfs.sh
TEST_FILES := $(test_objs)
include ../lib.mk
clean:
rm -f $(test_objs)

View File

@ -1,27 +1,23 @@
CFLAGS = -Wall
BINARIES = execveat
DEPS = execveat.symlink execveat.denatured script subdir
all: $(BINARIES) $(DEPS)
subdir:
mkdir -p $@
script:
echo '#!/bin/sh' > $@
echo 'exit $$*' >> $@
chmod +x $@
execveat.symlink: execveat
ln -s -f $< $@
execveat.denatured: execveat
cp $< $@
chmod -x $@
%: %.c
$(CC) $(CFLAGS) -o $@ $^
TEST_PROGS := execveat
TEST_GEN_PROGS := execveat
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
# Makefile is a run-time dependency, since it's accessed by the execveat test
TEST_FILES := $(DEPS) Makefile
TEST_FILES := Makefile
EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*
include ../lib.mk
clean:
rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
$(OUTPUT)/subdir:
mkdir -p $@
$(OUTPUT)/script:
echo '#!/bin/sh' > $@
echo 'exit $$*' >> $@
chmod +x $@
$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
cp $< $@
chmod -x $@

View File

@ -1,9 +1,7 @@
all:
TEST_PROGS := ftracetest
TEST_DIRS := test.d
TEST_FILES := test.d
EXTRA_CLEAN := $(OUTPUT)/logs/*
include ../lib.mk
clean:
rm -rf logs/*

View File

@ -3,13 +3,18 @@ SUBDIRS := functional
TEST_PROGS := run.sh
.PHONY: all clean
all:
for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
include ../lib.mk
all:
for DIR in $(SUBDIRS); do \
BUILD_TARGET=$$OUTPUT/$$DIR; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done
override define RUN_TESTS
./run.sh
@if [ `dirname $(OUTPUT)` = $(PWD) ]; then ./run.sh; fi
endef
override define INSTALL_RULE
@ -17,7 +22,9 @@ override define INSTALL_RULE
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@for SUBDIR in $(SUBDIRS); do \
$(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
BUILD_TARGET=$$OUTPUT/$$SUBDIR; \
mkdir $$BUILD_TARGET -p; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
done;
endef
@ -26,4 +33,8 @@ override define EMIT_TESTS
endef
clean:
for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
for DIR in $(SUBDIRS); do \
BUILD_TARGET=$$OUTPUT/$$DIR; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done

View File

@ -2,8 +2,11 @@ INCLUDES := -I../include -I../../
CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
LDFLAGS := $(LDFLAGS) -pthread -lrt
HEADERS := ../include/futextest.h
TARGETS := \
HEADERS := \
../include/futextest.h \
../include/atomic.h \
../include/logging.h
TEST_GEN_FILES := \
futex_wait_timeout \
futex_wait_wouldblock \
futex_requeue_pi \
@ -12,14 +15,8 @@ TARGETS := \
futex_wait_uninitialized_heap \
futex_wait_private_mapped_file
TEST_PROGS := $(TARGETS) run.sh
.PHONY: all clean
all: $(TARGETS)
$(TARGETS): $(HEADERS)
TEST_PROGS := run.sh
include ../../lib.mk
clean:
rm -f $(TARGETS)
$(TEST_GEN_FILES): $(HEADERS)

View File

@ -21,6 +21,7 @@
#ifndef _LOGGING_H
#define _LOGGING_H
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <linux/futex.h>

View File

@ -0,0 +1 @@
gpio-mockup-chardev

View File

@ -1,15 +1,10 @@
CC := $(CROSS_COMPILE)gcc
CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
LDFLAGS := $(LDFLAGS) -lm
TARGETS := msr aperf
TEST_GEN_FILES := msr aperf
TEST_PROGS := $(TARGETS) run.sh
TEST_PROGS := run.sh
.PHONY: all clean
all: $(TARGETS)
include ../lib.mk
$(TARGETS): $(HEADERS)
clean:
rm -f $(TARGETS)
$(TEST_GEN_FILES): $(HEADERS)

View File

@ -14,7 +14,7 @@ void usage(char *name) {
}
int main(int argc, char **argv) {
int i, cpu, fd;
unsigned int i, cpu, fd;
char msr_file_name[64];
long long tsc, old_tsc, new_tsc;
long long aperf, old_aperf, new_aperf;

View File

@ -1 +1,2 @@
msgque_test
msgque

View File

@ -11,12 +11,7 @@ endif
CFLAGS += -I../../../../usr/include/
all:
$(CC) $(CFLAGS) msgque.c -o msgque_test
TEST_PROGS := msgque_test
TEST_GEN_PROGS := msgque
include ../lib.mk
clean:
rm -fr ./msgque_test

View File

@ -1,10 +1,8 @@
CFLAGS += -I../../../../usr/include/
all: kcmp_test
TEST_GEN_PROGS := kcmp_test
TEST_PROGS := kcmp_test
EXTRA_CLEAN := $(OUTPUT)/kcmp-test-file
include ../lib.mk
clean:
$(RM) kcmp_test kcmp-test-file

View File

@ -2,9 +2,15 @@
# Makefile can operate with or without the kbuild infrastructure.
CC := $(CROSS_COMPILE)gcc
TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
define RUN_TESTS
@for TEST in $(TEST_PROGS); do \
(./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
BASENAME_TEST=`basename $$TEST`; \
cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\
done;
endef
@ -14,8 +20,13 @@ run_tests: all
define INSTALL_RULE
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
mkdir -p ${INSTALL_PATH}; \
echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
fi
@if [ "X$(TEST_GEN_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then \
mkdir -p ${INSTALL_PATH}; \
echo "rsync -a $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/"; \
rsync -a $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/; \
fi
endef
@ -27,12 +38,25 @@ else
endif
define EMIT_TESTS
@for TEST in $(TEST_PROGS); do \
echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
BASENAME_TEST=`basename $$TEST`; \
echo "(./$$BASENAME_TEST && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \
done;
endef
emit_tests:
$(EMIT_TESTS)
clean:
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
$(OUTPUT)/%:%.c
$(LINK.c) $^ $(LDLIBS) -o $@
$(OUTPUT)/%.o:%.S
$(COMPILE.S) $^ -o $@
$(OUTPUT)/%:%.S
$(LINK.S) $^ $(LDLIBS) -o $@
.PHONY: run_tests all clean install emit_tests

View File

@ -1,10 +1,6 @@
CFLAGS += -g -I../../../../usr/include/
TEST_PROGS := membarrier_test
all: $(TEST_PROGS)
TEST_GEN_PROGS := membarrier_test
include ../lib.mk
clean:
$(RM) $(TEST_PROGS)

View File

@ -1,22 +1,13 @@
CC = $(CROSS_COMPILE)gcc
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I../../../../include/uapi/
CFLAGS += -I../../../../include/
CFLAGS += -I../../../../usr/include/
TEST_PROGS := memfd_test
all: $(TEST_PROGS)
include ../lib.mk
build_fuse: fuse_mnt fuse_test
TEST_PROGS := run_fuse_test.sh
TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
run_fuse: build_fuse
@./run_fuse_test.sh || echo "fuse_test: [FAIL]"
include ../lib.mk
clean:
$(RM) memfd_test fuse_test

View File

@ -1,14 +1,11 @@
# Makefile for mount selftests.
CFLAGS = -Wall \
-O2
all: unprivileged-remount-test
unprivileged-remount-test: unprivileged-remount-test.c
$(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test
TEST_GEN_PROGS := unprivileged-remount-test
include ../lib.mk
TEST_PROGS := unprivileged-remount-test
override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
then \
./unprivileged-remount-test ; \
@ -17,5 +14,3 @@ override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
fi
override EMIT_TESTS := echo "$(RUN_TESTS)"
clean:
rm -f unprivileged-remount-test

View File

@ -1,8 +1,6 @@
CFLAGS += -O2
LDLIBS = -lrt -lpthread -lpopt
TEST_PROGS := mq_open_tests mq_perf_tests
all: $(TEST_PROGS)
TEST_GEN_PROGS := mq_open_tests mq_perf_tests
include ../lib.mk
@ -16,5 +14,3 @@ override define EMIT_TESTS
echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
endef
clean:
rm -f mq_open_tests mq_perf_tests

View File

@ -3,20 +3,13 @@
CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
CFLAGS += -I../../../../usr/include/
NET_PROGS = socket
NET_PROGS += psock_fanout psock_tpacket
NET_PROGS += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
NET_PROGS += reuseport_dualstack
all: $(NET_PROGS)
reuseport_bpf_numa: LDFLAGS += -lnuma
%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh
TEST_FILES := $(NET_PROGS)
TEST_GEN_FILES = socket
TEST_GEN_FILES += psock_fanout psock_tpacket
TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
TEST_GEN_FILES += reuseport_dualstack
include ../lib.mk
clean:
$(RM) $(NET_PROGS)

View File

@ -1,12 +1,5 @@
TEST_PROGS := owner pidns
TEST_GEN_PROGS := owner pidns
CFLAGS := -Wall -Werror
all: owner pidns
owner: owner.c
pidns: pidns.c
clean:
$(RM) owner pidns
include ../lib.mk

View File

@ -34,31 +34,35 @@ endif
all: $(SUB_DIRS)
$(SUB_DIRS):
$(MAKE) -k -C $@ all
BUILD_TARGET=$$OUTPUT/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
include ../lib.mk
override define RUN_TESTS
@for TARGET in $(SUB_DIRS); do \
$(MAKE) -C $$TARGET run_tests; \
BUILD_TARGET=$$OUTPUT/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
done;
endef
override define INSTALL_RULE
@for TARGET in $(SUB_DIRS); do \
$(MAKE) -C $$TARGET install; \
BUILD_TARGET=$$OUTPUT/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\
done;
endef
override define EMIT_TESTS
@for TARGET in $(SUB_DIRS); do \
$(MAKE) -s -C $$TARGET emit_tests; \
BUILD_TARGET=$$OUTPUT/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
done;
endef
clean:
@for TARGET in $(SUB_DIRS); do \
$(MAKE) -C $$TARGET clean; \
BUILD_TARGET=$$OUTPUT/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
done;
rm -f tags

View File

@ -1,10 +1,5 @@
TEST_PROGS := copy_unaligned copy_first_unaligned paste_unaligned paste_last_unaligned
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c ../utils.c copy_paste_unaligned_common.c
TEST_GEN_PROGS := copy_unaligned copy_first_unaligned paste_unaligned paste_last_unaligned
include ../../lib.mk
clean:
rm -f $(TEST_PROGS)
$(TEST_GEN_PROGS): ../harness.c ../utils.c copy_paste_unaligned_common.c

View File

@ -1,16 +1,11 @@
TEST_PROGS := gettimeofday context_switch mmap_bench futex_bench null_syscall
TEST_GEN_PROGS := gettimeofday context_switch mmap_bench futex_bench null_syscall
CFLAGS += -O2
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
context_switch: ../utils.c
context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
context_switch: LDLIBS += -lpthread
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): ../harness.c
$(OUTPUT)/context_switch: ../utils.c
$(OUTPUT)/context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
$(OUTPUT)/context_switch: LDLIBS += -lpthread

View File

@ -1,10 +1,5 @@
TEST_PROGS := cp_abort
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c ../utils.c
TEST_GEN_PROGS := cp_abort
include ../../lib.mk
clean:
rm -f $(TEST_PROGS)
$(TEST_GEN_PROGS): ../harness.c ../utils.c

View File

@ -7,19 +7,14 @@ CFLAGS += -maltivec
# Use our CFLAGS for the implicit .S rule
ASFLAGS = $(CFLAGS)
TEST_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
TEST_GEN_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
EXTRA_SOURCES := validate.c ../harness.c
all: $(TEST_PROGS)
copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
memcpy_64: CPPFLAGS += -D COPY_LOOP=test_memcpy
memcpy_power7: CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
$(TEST_PROGS): $(EXTRA_SOURCES)
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(OUTPUT)/copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
$(OUTPUT)/copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
$(OUTPUT)/memcpy_64: CPPFLAGS += -D COPY_LOOP=test_memcpy
$(OUTPUT)/memcpy_power7: CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)

View File

@ -1,14 +1,9 @@
TEST_PROGS := dscr_default_test dscr_explicit_test dscr_user_test \
TEST_GEN_PROGS := dscr_default_test dscr_explicit_test dscr_user_test \
dscr_inherit_test dscr_inherit_exec_test dscr_sysfs_test \
dscr_sysfs_thread_test
dscr_default_test: LDLIBS += -lpthread
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
$(TEST_GEN_PROGS): ../harness.c

View File

@ -1,22 +1,17 @@
TEST_PROGS := fpu_syscall fpu_preempt fpu_signal vmx_syscall vmx_preempt vmx_signal vsx_preempt
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
$(TEST_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
fpu_syscall: fpu_asm.S
fpu_preempt: fpu_asm.S
fpu_signal: fpu_asm.S
vmx_syscall: vmx_asm.S
vmx_preempt: vmx_asm.S
vmx_signal: vmx_asm.S
vsx_preempt: CFLAGS += -mvsx
vsx_preempt: vsx_asm.S
TEST_GEN_PROGS := fpu_syscall fpu_preempt fpu_signal vmx_syscall vmx_preempt vmx_signal vsx_preempt
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): ../harness.c
$(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
$(OUTPUT)/fpu_syscall: fpu_asm.S
$(OUTPUT)/fpu_preempt: fpu_asm.S
$(OUTPUT)/fpu_signal: fpu_asm.S
$(OUTPUT)/vmx_syscall: vmx_asm.S
$(OUTPUT)/vmx_preempt: vmx_asm.S
$(OUTPUT)/vmx_signal: vmx_asm.S
$(OUTPUT)/vsx_preempt: CFLAGS += -mvsx
$(OUTPUT)/vsx_preempt: vsx_asm.S

View File

@ -1,19 +1,15 @@
noarg:
$(MAKE) -C ../
TEST_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
TEST_FILES := tempfile
all: $(TEST_PROGS) $(TEST_FILES)
$(TEST_PROGS): ../harness.c
prot_sao: ../utils.c
TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao
TEST_GEN_FILES := tempfile
include ../../lib.mk
tempfile:
dd if=/dev/zero of=tempfile bs=64k count=1
$(TEST_GEN_PROGS): ../harness.c
$(OUTPUT)/prot_sao: ../utils.c
$(OUTPUT)/tempfile:
dd if=/dev/zero of=$@ bs=64k count=1
clean:
rm -f $(TEST_PROGS) tempfile

View File

@ -1,44 +1,44 @@
noarg:
$(MAKE) -C ../
TEST_PROGS := count_instructions l3_bank_test per_event_excludes
TEST_GEN_PROGS := count_instructions l3_bank_test per_event_excludes
EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
all: $(TEST_PROGS) ebb
include ../../lib.mk
$(TEST_PROGS): $(EXTRA_SOURCES)
all: $(TEST_GEN_PROGS) ebb
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
# loop.S can only be built 64-bit
count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
$(CC) $(CFLAGS) -m64 -o $@ $^
per_event_excludes: ../utils.c
include ../../lib.mk
$(OUTPUT)/per_event_excludes: ../utils.c
DEFAULT_RUN_TESTS := $(RUN_TESTS)
override define RUN_TESTS
$(DEFAULT_RUN_TESTS)
$(MAKE) -C ebb run_tests
TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
endef
DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
override define EMIT_TESTS
$(DEFAULT_EMIT_TESTS)
$(MAKE) -s -C ebb emit_tests
TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
endef
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
override define INSTALL_RULE
$(DEFAULT_INSTALL_RULE)
$(MAKE) -C ebb install
TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
endef
clean:
rm -f $(TEST_PROGS) loop.o
$(MAKE) -C ebb clean
$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
ebb:
$(MAKE) -k -C $@ all
TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
.PHONY: all run_tests clean ebb

View File

@ -4,7 +4,7 @@ noarg:
# The EBB handler is 64-bit code and everything links against it
CFLAGS += -m64
TEST_PROGS := reg_access_test event_attributes_test cycles_test \
TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
cycles_with_freeze_test pmc56_overflow_test \
ebb_vs_cpu_event_test cpu_event_vs_ebb_test \
cpu_event_pinned_vs_ebb_test task_event_vs_ebb_test \
@ -16,16 +16,11 @@ TEST_PROGS := reg_access_test event_attributes_test cycles_test \
lost_exception_test no_handler_test \
cycles_with_mmcr2_test
all: $(TEST_PROGS)
$(TEST_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
ebb.c ebb_handler.S trace.c busy_loop.S
instruction_count_test: ../loop.S
lost_exception_test: ../lib.c
include ../../../lib.mk
clean:
rm -f $(TEST_PROGS)
$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
ebb.c ebb_handler.S trace.c busy_loop.S
$(OUTPUT)/instruction_count_test: ../loop.S
$(OUTPUT)/lost_exception_test: ../lib.c

View File

@ -1,12 +1,7 @@
CFLAGS += -I$(CURDIR)
TEST_PROGS := load_unaligned_zeropad
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
TEST_GEN_PROGS := load_unaligned_zeropad
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): ../harness.c

View File

@ -2,14 +2,9 @@
CFLAGS += -m64
CFLAGS += -I$(CURDIR)
TEST_PROGS := memcmp
TEST_GEN_PROGS := memcmp
EXTRA_SOURCES := memcmp_64.S ../harness.c
all: $(TEST_PROGS)
$(TEST_PROGS): $(EXTRA_SOURCES)
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)

View File

@ -1,18 +1,15 @@
TEST_PROGS := switch_endian_test
TEST_GEN_PROGS := switch_endian_test
ASFLAGS += -O2 -Wall -g -nostdlib -m64
all: $(TEST_PROGS)
switch_endian_test: check-reversed.S
check-reversed.o: check.o
$(CROSS_COMPILE)objcopy -j .text --reverse-bytes=4 -O binary $< $@
check-reversed.S: check-reversed.o
hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o check-reversed.S
$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
$(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o
$(CROSS_COMPILE)objcopy -j .text --reverse-bytes=4 -O binary $< $@
$(OUTPUT)/check-reversed.S: $(OUTPUT)/check-reversed.o
hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@

View File

@ -1,12 +1,7 @@
TEST_PROGS := ipc_unmuxed
TEST_GEN_PROGS := ipc_unmuxed
CFLAGS += -I../../../../../usr/include
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): ../harness.c

View File

@ -1,23 +1,19 @@
SIGNAL_CONTEXT_CHK_TESTS := tm-signal-context-chk-gpr tm-signal-context-chk-fpu \
tm-signal-context-chk-vmx tm-signal-context-chk-vsx
TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
TEST_GEN_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
tm-vmxcopy tm-fork tm-tar tm-tmspr $(SIGNAL_CONTEXT_CHK_TESTS)
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c ../utils.c
CFLAGS += -mhtm
tm-syscall: tm-syscall-asm.S
tm-syscall: CFLAGS += -I../../../../../usr/include
tm-tmspr: CFLAGS += -pthread
$(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
$(SIGNAL_CONTEXT_CHK_TESTS): CFLAGS += -mhtm -m64 -mvsx
include ../../lib.mk
clean:
rm -f $(TEST_PROGS) *.o
$(TEST_GEN_PROGS): ../harness.c ../utils.c
CFLAGS += -mhtm
$(OUTPUT)/tm-syscall: tm-syscall-asm.S
$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
$(OUTPUT)/tm-tmspr: CFLAGS += -pthread
SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS))
$(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
$(SIGNAL_CONTEXT_CHK_TESTS): CFLAGS += -mhtm -m64 -mvsx

View File

@ -1,12 +1,8 @@
TEST_PROGS := test-vphn
TEST_GEN_PROGS := test-vphn
CFLAGS += -m64
all: $(TEST_PROGS)
$(TEST_PROGS): ../harness.c
include ../../lib.mk
clean:
rm -f $(TEST_PROGS)
$(TEST_GEN_PROGS): ../harness.c

View File

@ -5,11 +5,9 @@ all:
TEST_PROGS := pstore_tests pstore_post_reboot_tests
TEST_FILES := common_tests pstore_crash_test
EXTRA_CLEAN := logs/* *uuid
include ../lib.mk
run_crash:
@sh pstore_crash_test || { echo "pstore_crash_test: [FAIL]"; exit 1; }
clean:
rm -rf logs/* *uuid

View File

@ -1,11 +1,5 @@
CFLAGS += -iquote../../../../include/uapi -Wall
peeksiginfo: peeksiginfo.c
all: peeksiginfo
clean:
rm -f peeksiginfo
TEST_PROGS := peeksiginfo
TEST_GEN_PROGS := peeksiginfo
include ../lib.mk

View File

@ -1,10 +1,6 @@
TEST_PROGS := seccomp_bpf
TEST_GEN_PROGS := seccomp_bpf
CFLAGS += -Wl,-no-as-needed -Wall
LDFLAGS += -lpthread
all: $(TEST_PROGS)
include ../lib.mk
clean:
$(RM) $(TEST_PROGS)

View File

@ -1,8 +1,5 @@
CFLAGS = -Wall
BINARIES = sas
all: $(BINARIES)
TEST_GEN_PROGS = sas
include ../lib.mk
clean:
rm -rf $(BINARIES)

View File

@ -1,11 +1,5 @@
all: get_size
CFLAGS := -static -ffreestanding -nostartfiles -s
get_size: get_size.c
$(CC) -static -ffreestanding -nostartfiles -s $< -o $@
TEST_PROGS := get_size
TEST_GEN_PROGS := get_size
include ../lib.mk
clean:
$(RM) get_size

View File

@ -1,20 +1,16 @@
CC = $(CROSS_COMPILE)gcc
BUILD_FLAGS = -DKTEST
CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
LDFLAGS += -lrt -lpthread
# these are all "safe" tests that don't modify
# system time or require escalated privledges
TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
TEST_GEN_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
inconsistency-check raw_skew threadtest rtctest
TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
TEST_GEN_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
skew_consistency clocksource-switch leap-a-day \
leapcrash set-tai set-2038 set-tz
bins = $(TEST_PROGS) $(TEST_PROGS_EXTENDED)
all: ${bins}
include ../lib.mk
@ -34,5 +30,3 @@ run_destructive_tests: run_tests
./set-tai
./set-2038
clean:
rm -f ${bins}

View File

@ -1,41 +1,33 @@
# Makefile for vm selftests
CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
BINARIES = compaction_test
BINARIES += hugepage-mmap
BINARIES += hugepage-shm
BINARIES += map_hugetlb
BINARIES += mlock2-tests
BINARIES += on-fault-limit
BINARIES += thuge-gen
BINARIES += transhuge-stress
BINARIES += userfaultfd
BINARIES += userfaultfd_hugetlb
BINARIES += userfaultfd_shmem
BINARIES += mlock-random-test
all: $(BINARIES)
%: %.c
$(CC) $(CFLAGS) -o $@ $^ -lrt
userfaultfd: userfaultfd.c ../../../../usr/include/linux/kernel.h
$(CC) $(CFLAGS) -O2 -o $@ $< -lpthread
userfaultfd_hugetlb: userfaultfd.c ../../../../usr/include/linux/kernel.h
$(CC) $(CFLAGS) -DHUGETLB_TEST -O2 -o $@ $< -lpthread
userfaultfd_shmem: userfaultfd.c ../../../../usr/include/linux/kernel.h
$(CC) $(CFLAGS) -DSHMEM_TEST -O2 -o $@ $< -lpthread
mlock-random-test: mlock-random-test.c
$(CC) $(CFLAGS) -o $@ $< -lcap
../../../../usr/include/linux/kernel.h:
make -C ../../../.. headers_install
LDLIBS = -lrt
TEST_GEN_FILES = compaction_test
TEST_GEN_FILES += hugepage-mmap
TEST_GEN_FILES += hugepage-shm
TEST_GEN_FILES += map_hugetlb
TEST_GEN_FILES += mlock2-tests
TEST_GEN_FILES += on-fault-limit
TEST_GEN_FILES += thuge-gen
TEST_GEN_FILES += transhuge-stress
TEST_GEN_FILES += userfaultfd
TEST_GEN_FILES += userfaultfd_hugetlb
TEST_GEN_FILES += userfaultfd_shmem
TEST_GEN_FILES += mlock-random-test
TEST_PROGS := run_vmtests
TEST_FILES := $(BINARIES)
include ../lib.mk
clean:
$(RM) $(BINARIES)
$(OUTPUT)/userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h
$(OUTPUT)/userfaultfd_hugetlb: userfaultfd.c ../../../../usr/include/linux/kernel.h
$(CC) $(CFLAGS) -DHUGETLB_TEST -O2 -o $@ $< -lpthread
$(OUTPUT)/userfaultfd_shmem: userfaultfd.c ../../../../usr/include/linux/kernel.h
$(CC) $(CFLAGS) -DSHMEM_TEST -O2 -o $@ $< -lpthread
$(OUTPUT)/mlock-random-test: LDLIBS += -lcap
../../../../usr/include/linux/kernel.h:
make -C ../../../.. headers_install

View File

@ -17,6 +17,9 @@ TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
UNAME_M := $(shell uname -m)
@ -40,10 +43,10 @@ all_64: $(BINARIES_64)
clean:
$(RM) $(BINARIES_32) $(BINARIES_64)
$(TARGETS_C_32BIT_ALL:%=%_32): %_32: %.c
$(BINARIES_32): $(OUTPUT)/%_32: %.c
$(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm
$(TARGETS_C_64BIT_ALL:%=%_64): %_64: %.c
$(BINARIES_64): $(OUTPUT)/%_64: %.c
$(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
# x86_64 users should be encouraged to install 32-bit libraries
@ -65,12 +68,12 @@ warn_32bit_failure:
endif
# Some tests have additional dependencies.
sysret_ss_attrs_64: thunks.S
ptrace_syscall_32: raw_syscall_helper_32.S
test_syscall_vdso_32: thunks_32.S
$(OUTPUT)/sysret_ss_attrs_64: thunks.S
$(OUTPUT)/ptrace_syscall_32: raw_syscall_helper_32.S
$(OUTPUT)/test_syscall_vdso_32: thunks_32.S
# check_initial_reg_state is special: it needs a custom entry, and it
# needs to be static so that its interpreter doesn't destroy its initial
# state.
check_initial_reg_state_32: CFLAGS += -Wl,-ereal_start -static
check_initial_reg_state_64: CFLAGS += -Wl,-ereal_start -static
$(OUTPUT)/check_initial_reg_state_32: CFLAGS += -Wl,-ereal_start -static
$(OUTPUT)/check_initial_reg_state_64: CFLAGS += -Wl,-ereal_start -static

View File

@ -192,7 +192,7 @@ void lots_o_noops_around_write(int *write_to_me)
#define SYS_pkey_alloc 381
#define SYS_pkey_free 382
#define REG_IP_IDX REG_EIP
#define si_pkey_offset 0x18
#define si_pkey_offset 0x14
#else
#define SYS_mprotect_key 329
#define SYS_pkey_alloc 330
@ -462,7 +462,7 @@ void pkey_disable_set(int pkey, int flags)
unsigned long syscall_flags = 0;
int ret;
int pkey_rights;
u32 orig_pkru;
u32 orig_pkru = rdpkru();
dprintf1("START->%s(%d, 0x%x)\n", __func__,
pkey, flags);
@ -812,8 +812,6 @@ void setup_hugetlbfs(void)
{
int err;
int fd;
int validated_nr_pages;
int i;
char buf[] = "123";
if (geteuid() != 0) {
@ -1116,11 +1114,6 @@ void test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey)
err = sys_pkey_free(i);
pkey_assert(err);
/* not enforced when pkey_get() is not a syscall
err = pkey_get(i, 0);
pkey_assert(err < 0);
*/
err = sys_pkey_free(i);
pkey_assert(err);
@ -1133,14 +1126,8 @@ void test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey)
void test_pkey_syscalls_bad_args(int *ptr, u16 pkey)
{
int err;
int bad_flag = (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE) + 1;
int bad_pkey = NR_PKEYS+99;
/* not enforced when pkey_get() is not a syscall
err = pkey_get(bad_pkey, bad_flag);
pkey_assert(err < 0);
*/
/* pass a known-invalid pkey in: */
err = sys_mprotect_pkey(ptr, PAGE_SIZE, PROT_READ, bad_pkey);
pkey_assert(err);
@ -1149,8 +1136,6 @@ void test_pkey_syscalls_bad_args(int *ptr, u16 pkey)
/* Assumes that all pkeys other than 'pkey' are unallocated */
void test_pkey_alloc_exhaust(int *ptr, u16 pkey)
{
unsigned long flags;
unsigned long init_val;
int err;
int allocated_pkeys[NR_PKEYS] = {0};
int nr_allocated_pkeys = 0;

View File

@ -2,8 +2,7 @@ all:
TEST_PROGS := zram.sh
TEST_FILES := zram01.sh zram02.sh zram_lib.sh
EXTRA_CLEAN := err.log
include ../lib.mk
clean:
$(RM) err.log