Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion memory/memtester.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,35 @@ def setUp(self):
'''
smm = SoftwareManager()

for pkg in ['gcc', 'make']:
for pkg in ['gcc', 'make', 'patch']:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel('%s is needed for the test to be run' % pkg)
try:
gcc_version_output = process.run('gcc --version', shell=True).stdout_text
gcc_major_version = int(gcc_version_output.split()[2].split('.')[0])
self.log.info(f"Detected GCC version: {gcc_major_version}")
except Exception as e:
self.log.warning(f"Could not detect GCC version: {e}. Assuming patch is needed.")
gcc_major_version = 15
tarball = self.fetch_asset('memtester.zip',
locations=['https://github.com/jnavila/'
'memtester/archive/master.zip'],
expire='7d')
archive.extract(tarball, self.workdir)
sourcedir = os.path.join(self.workdir, 'memtester-master')
os.chdir(sourcedir)
if gcc_major_version >= 15:
memtester_patch = 'patch -p0 < %s' % os.path.abspath(
self.get_data('memtester_gcc15.patch'))
try:
process.run(memtester_patch, shell=True)
self.log.info("Applied memtester patch to fix GCC 15+ compilation issues")
except Exception as e:
self.cancel(f"Failed to apply required GCC 15+ patch: {e}. "
f"This patch is mandatory for GCC {gcc_major_version} to avoid "
f"implicit function declaration errors during compilation.")
else:
self.log.info(f"GCC version {gcc_major_version} detected. Patch not required.")
process.system('chmod 755 extra-libs.sh', shell=True, sudo=True,
ignore_status=True)
build.make(sourcedir)
Expand Down
26 changes: 26 additions & 0 deletions memory/memtester.py.data/memtester_gcc15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- output.h 2024-01-01 00:00:00.000000000 +0000
+++ output.h 2024-01-01 00:00:00.000000000 +0000
@@ -9,11 +9,11 @@
void out_initialize();

void out_test_start();
-void out_test_setting();
-void out_test_testing();
+void out_test_setting(unsigned int j);
+void out_test_testing(unsigned int j);
void out_test_end();

void out_wheel_start();
-void out_wheel_advance();
+void out_wheel_advance(unsigned int i);
void out_wheel_end();

--- types.h 2024-01-01 00:00:00.000000000 +0000
+++ types.h 2024-01-01 00:00:00.000000000 +0000
@@ -22,5 +22,5 @@

struct test {
char *name;
- int (*fp)();
+ int (*fp)(ulv *bufa, ulv *bufb, size_t count);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the latest memtester source contains code that uses updated function signatures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sachin

yes, while calling the functions arguments are passed but during declaration arguments were not explicitly declared.

Loading