-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2774 from sacsant/willitscale
kernel/will-it-scale: Add scalability test
- Loading branch information
Showing
3 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env python | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# See LICENSE for more details. | ||
# | ||
# Copyright: 2024 IBM | ||
# Author: Sachin Sant <[email protected]> | ||
# | ||
|
||
|
||
import os | ||
import shutil | ||
from sys import version_info | ||
|
||
from avocado import Test | ||
from avocado import skipIf | ||
from avocado.utils import process, build, memory, archive | ||
from avocado.utils.software_manager.manager import SoftwareManager | ||
|
||
SINGLE_NODE = len(memory.numa_nodes_with_memory()) < 2 | ||
VERSION_CHK = version_info[0] < 4 and version_info[1] < 7 | ||
|
||
|
||
class WillItScaleTest(Test): | ||
""" | ||
Will It Scale takes a testcase and runs n parallel copies to see if the | ||
testcase will scale. | ||
Source - https://github.com/antonblanchard/will-it-scale | ||
:avocado: tags=kernel,ppc64le | ||
""" | ||
|
||
@skipIf(SINGLE_NODE, "Test requires atleast two numa nodes") | ||
@skipIf(VERSION_CHK, "Test requires Python 3.7+") | ||
def setUp(self): | ||
""" | ||
To execute test using git copy | ||
make | ||
./runalltests | ||
To generate graphical results | ||
./postprocess.py | ||
""" | ||
smm = SoftwareManager() | ||
for package in ['gcc', 'make', 'hwloc-devel']: | ||
if not smm.check_installed(package) and not smm.install(package): | ||
self.cancel('%s is needed for the test to be run' % package) | ||
|
||
self.postprocess = self.params.get('postprocess', default=True) | ||
self.testcase = self.params.get('name', default='brk1') | ||
url = self.params.get( | ||
'willit_url', default='https://github.com/antonblanchard/' | ||
'will-it-scale/archive/refs/heads/master.zip') | ||
tarball = self.fetch_asset('willit.zip', locations=[url], | ||
expire='7d') | ||
archive.extract(tarball, self.workdir) | ||
self.sourcedir = os.path.join(self.workdir, 'will-it-scale-master') | ||
os.chdir(self.sourcedir) | ||
if build.make(self.sourcedir): | ||
self.fail('make failed, please check debug logs') | ||
|
||
def test_scaleitall(self): | ||
""" | ||
Invoke and execute test(s) | ||
""" | ||
os.chdir(self.sourcedir) | ||
self.log.info("Starting test...") | ||
|
||
# Identify the test to be executed | ||
if self.testcase in 'All': | ||
cmd = './runalltests' | ||
else: | ||
cmd = './runtest.py %s > %s.csv' % (self.testcase, self.testcase) | ||
|
||
# Execute the test(s) | ||
if process.system(cmd, shell=True, sudo=True, ignore_status=True) != 0: | ||
self.fail('Please check the logs for failure') | ||
if self.testcase not in 'All': | ||
shutil.copy(f"{self.testcase}.csv", self.logdir) | ||
|
||
# Generate graphical results if postprocessing is enabled | ||
if self.postprocess: | ||
cmd = './postprocess.py' | ||
if process.system(cmd, shell=True, ignore_status=True) != 0: | ||
self.warn('Post processing failed, graph may not be generated') | ||
if self.testcase not in 'All': | ||
shutil.copy(f"{self.testcase}.html", self.logdir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Source : https://github.com/antonblanchard/will-it-scale | ||
|
||
Will It Scale takes a testcase and runs it from 1 through to n parallel copies | ||
to see if the testcase will scale. It builds both a process and threads based | ||
test in order to see any differences between the two. | ||
|
||
Following is a list of testcase currently supported. | ||
|
||
- brk1 | ||
- brk2 | ||
- context_switch1 | ||
- dup1 | ||
- eventfd1 | ||
- fallocate1 | ||
- fallocate2 | ||
- futex1 | ||
- futex2 | ||
- futex3 | ||
- futex4 | ||
- getppid1 | ||
- lock1 | ||
- lock2 | ||
- lseek1 | ||
- lseek2 | ||
- malloc1 | ||
- malloc2 | ||
- mmap1 | ||
- mmap2 | ||
- open1 | ||
- open2 | ||
- open3 | ||
- page_fault1 | ||
- page_fault2 | ||
- page_fault3 | ||
- pipe1 | ||
- poll1 | ||
- poll2 | ||
- posix_semaphore1 | ||
- pread1 | ||
- pread2 | ||
- pread3 | ||
- pthread_mutex1 | ||
- pthread_mutex2 | ||
- pthread_mutex3 | ||
- pthread_mutex4 | ||
- pthread_mutex5 | ||
- pwrite1 | ||
- pwrite2 | ||
- pwrite3 | ||
- read1 | ||
- read2 | ||
- read3 | ||
- read4 | ||
- readseek1 | ||
- readseek2 | ||
- readseek3 | ||
- sched_yield | ||
- signal1 | ||
- tlb_flush1 | ||
- tlb_flush2 | ||
- tlb_flush3 | ||
- unix1 | ||
- unlink1 | ||
- unlink2 | ||
- write1 | ||
- writeseek1 | ||
- writeseek2 | ||
- writeseek3 | ||
|
||
A yaml file included with this test case allows a user to invoke one or many | ||
testcases. Each testcase can take upto an hour or so depending on amount of | ||
resources available on the system under test. runalltests will invoke all the | ||
tests and can take a very long time(to the order of day) to complete. | ||
runtest.py can be used to run individual tests | ||
|
||
To run a specific test use following stanza in yaml: | ||
postprocess: True | ||
testcase: !mux | ||
brk1: | ||
name: brk1 | ||
|
||
To run all tests use following stanza: | ||
postprocess: True | ||
testcase: !mux | ||
All: | ||
name: All | ||
|
||
Individual .csv and .html result files are copied to log directory. | ||
|
||
This test requires | ||
- more than one NUMA node | ||
- python 3.7+ | ||
- hwloc binaries & libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
postprocess: True | ||
testcase: !mux | ||
brk1: | ||
name: brk1 | ||
brk2: | ||
name: brk2 | ||
context_switch1: | ||
name: context_switch1 | ||
dup1: | ||
name: dup1 | ||
eventfd1: | ||
name: eventfd1 | ||
fallocate1: | ||
name: fallocate1 | ||
fallocate2: | ||
name: fallocate2 | ||
futex1: | ||
name: futex1 | ||
futex2: | ||
name: futex2 | ||
futex3: | ||
name: futex3 | ||
futex4: | ||
name: futex4 | ||
getppid1: | ||
name: getppid1 | ||
lock1: | ||
name: lock1 | ||
lock2: | ||
name: lock2 | ||
lseek1: | ||
name: lseek1 | ||
lseek2: | ||
name: lseek2 | ||
malloc1: | ||
name: malloc1 | ||
malloc2: | ||
name: malloc2 | ||
mmap1: | ||
name: mmap1 | ||
mmap2: | ||
name: mmap2 | ||
open1: | ||
name: open1 | ||
open2: | ||
name: open2 | ||
open3: | ||
name: open3 | ||
page_fault1: | ||
name: page_fault1 | ||
page_fault2: | ||
name: page_fault2 | ||
page_fault3: | ||
name: page_fault3 | ||
pipe1: | ||
name: pipe1 | ||
poll1: | ||
name: poll1 | ||
poll2: | ||
name: poll2 | ||
posix_semaphore1: | ||
name: posix_semaphore1 | ||
pread1: | ||
name: pread1 | ||
pread2: | ||
name: pread2 | ||
pread3: | ||
name: pread3 | ||
pthread_mutex1: | ||
name: pthread_mutex1 | ||
pthread_mutex2: | ||
name: pthread_mutex2 | ||
pthread_mutex3: | ||
name: pthread_mutex3 | ||
pthread_mutex4: | ||
name: pthread_mutex4 | ||
pthread_mutex5: | ||
name: pthread_mutex5 | ||
pwrite1: | ||
name: pwrite1 | ||
pwrite2: | ||
name: pwrite2 | ||
pwrite3: | ||
name: pwrite3 | ||
read1: | ||
name: read1 | ||
read2: | ||
name: read2 | ||
read3: | ||
name: read3 | ||
read4: | ||
name: read4 | ||
readseek1: | ||
name: readseek1 | ||
readseek2: | ||
name: readseek2 | ||
readseek3: | ||
name: readseek3 | ||
sched_yield: | ||
name: sched_yield | ||
signal1: | ||
name: signal1 | ||
tlb_flush1: | ||
name: tlb_flush1 | ||
tlb_flush2: | ||
name: tlb_flush2 | ||
tlb_flush3: | ||
name: tlb_flush3 | ||
unix1: | ||
name: unix1 | ||
unlink1: | ||
name: unlink1 | ||
unlink2: | ||
name: unlink2 | ||
write1: | ||
name: write1 | ||
writeseek1: | ||
name: writeseek1 | ||
writeseek2: | ||
name: writeseek2 | ||
writeseek3: | ||
name: writeseek3 |