### Install memtester to Default Location Source: https://context7.com/jnavila/memtester/llms.txt Install the compiled memtester to the default system path (/usr/local/bin) using 'sudo make install'. ```bash # Install to default location (/usr/local/bin) sudo make install ``` -------------------------------- ### Install memtester to Custom Location Source: https://context7.com/jnavila/memtester/llms.txt Install memtester to a specific directory by setting the INSTALLPATH variable during the 'make install' process. ```bash # Install to custom location sudo make INSTALLPATH=/opt/memtester install ``` -------------------------------- ### Basic memtester Build Source: https://context7.com/jnavila/memtester/llms.txt Compile memtester from source using a simple 'make' command. Ensure you run 'make clean' before rebuilding if configuration changes. ```bash # Basic build - just run make make ``` -------------------------------- ### Basic Memory Testing with Memtester Source: https://context7.com/jnavila/memtester/llms.txt Run memtester with a specified amount of memory and optional iteration count. Memory sizes can be specified in bytes (B), kilobytes (K), megabytes (M), or gigabytes (G). Root privileges are recommended for memory locking. ```bash sudo memtester 100M ``` ```bash sudo memtester 256M 5 ``` ```bash sudo memtester 1G 10 ``` ```bash sudo memtester 512K 3 ``` ```bash # Example output: # memtester version 4.5.1 (64-bit) # Copyright (C) 2001-2020 Charles Cazabon. # Licensed under the GNU General Public License version 2 (only). # # pagesize is 4096 # pagesizemask is 0xfffffffffffff000 # want 100MB (104857600 bytes) # got 100MB (104857600 bytes), trying mlock ...locked. # Loop 1/5: # Stuck Address : ok # Random Value : ok # Compare XOR : ok # Compare SUB : ok # Compare MUL : ok # Compare DIV : ok # Compare OR : ok # Compare AND : ok # Sequential Increment: ok # Solid Bits : ok # Block Sequential : ok # Checkerboard : ok # Bit Spread : ok # Bit Flip : ok # Walking Ones : ok # Walking Zeroes : ok # 8-bit Writes : ok # 16-bit Writes : ok ``` -------------------------------- ### Cross-compile memtester for ARM Source: https://context7.com/jnavila/memtester/llms.txt Configure memtester for cross-compilation by specifying the compiler and linker in conf-cc and conf-ld files, then rebuild. ```bash # Cross-compile for ARM (edit conf-cc and conf-ld first) echo "armgcc" > conf-cc echo "armgcc" > conf-ld make clean && make ``` -------------------------------- ### Clean Build Artifacts Source: https://context7.com/jnavila/memtester/llms.txt Remove compiled object files and executables from the build directory using 'make clean'. ```bash # Clean build artifacts make clean ``` -------------------------------- ### Scripted memtester with Error Handling Source: https://context7.com/jnavila/memtester/llms.txt Execute memtester in a script and check its exit code to identify specific memory issues like address problems or general test failures. ```bash #!/bin/bash if sudo memtester 256M 3; then echo "Memory test passed" else code=$? if [ $((code & 2)) -ne 0 ]; then echo "CRITICAL: Address line problems detected" fi if [ $((code & 4)) -ne 0 ]; then echo "ERROR: Memory test failures detected" fi exit 1 fi ``` -------------------------------- ### C Function Signatures: Narrow Write Tests Source: https://context7.com/jnavila/memtester/llms.txt Conditional tests for 8-bit and 16-bit write operations, enabled only if TEST_NARROW_WRITES is defined. ```c // Narrow Write Tests - verify 8-bit and 16-bit write operations #ifdef TEST_NARROW_WRITES int test_8bit_wide_random(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_16bit_wide_random(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); #endif ``` -------------------------------- ### Selective Test Execution with MEMTESTER_TEST_MASK Source: https://context7.com/jnavila/memtester/llms.txt Use the MEMTESTER_TEST_MASK environment variable to run only specific tests. The bitmask corresponds to test indices (excluding Stuck Address which always runs). Ensure correct bitwise OR operations for multiple tests. ```bash # Run only Random Value test (0x01) MEMTESTER_TEST_MASK=0x01 sudo memtester 100M 1 ``` ```bash # Run only Walking Ones and Walking Zeroes tests (0x2000 | 0x4000 = 0x6000) MEMTESTER_TEST_MASK=0x6000 sudo memtester 100M 1 ``` ```bash # Run comparison tests only (XOR, SUB, MUL, DIV, OR, AND = 0x7E) MEMTESTER_TEST_MASK=0x7E sudo memtester 100M 1 ``` ```bash # Run all bit-pattern tests (Solid Bits, Checkerboard, Bit Spread, Bit Flip = 0x1D00) MEMTESTER_TEST_MASK=0x1D00 sudo memtester 100M 5 ``` -------------------------------- ### C Function Signatures: Comparison Tests Source: https://context7.com/jnavila/memtester/llms.txt These comparison tests catch permanently stuck bits in memory. They require two buffers for comparison. ```c // Comparison Tests - catch permanently stuck bits int test_random_value(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_xor_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_sub_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_mul_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_div_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_or_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_and_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); ``` -------------------------------- ### Physical Memory Address Testing with Memtester Source: https://context7.com/jnavila/memtester/llms.txt Test a specific physical memory region by memory-mapping /dev/mem or a custom device. This is primarily used by hardware developers. The memory region will be overwritten during testing, so use with caution. ```bash sudo memtester -p 0x0c0000 64K ``` ```bash sudo memtester -p 0x100000 1M 5 ``` ```bash sudo memtester -p 0 -d /dev/foodev 64K 10 ``` ```bash sudo memtester -p 0x80000000 -d /dev/mydevice 256K 3 ``` -------------------------------- ### Interpret memtester Exit Codes Source: https://context7.com/jnavila/memtester/llms.txt Use a case statement to interpret the exit code of memtester for detailed error reporting. ```bash case $exit_code in 0) echo "All tests passed successfully" ;; 1) echo "Error allocating/locking memory, or invocation error" ;; 2) echo "Stuck address test failed - memory addressing problem detected" ;; 4) echo "One or more memory tests failed - faulty memory detected" ;; 3) echo "Both allocation error and stuck address test failed" ;; 5) echo "Both allocation error and other test failures" ;; 6) echo "Both stuck address and other test failures" ;; 7) echo "All categories of errors encountered" ;; esac ``` -------------------------------- ### C Function Signatures: Pattern Tests Source: https://context7.com/jnavila/memtester/llms.txt Pattern tests are designed to catch flaky bits in memory. They typically involve sequential or solid bit patterns. ```c // Pattern Tests - catch flaky bits int test_seqinc_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_solidbits_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_blockseq_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); ``` -------------------------------- ### Disable Narrow Writes Tests Source: https://context7.com/jnavila/memtester/llms.txt Temporarily disable narrow writes tests by editing the conf-cc file to remove the -DTEST_NARROW_WRITES flag, then rebuild. ```bash # Disable narrow writes tests (for platforms with alignment issues) # Edit conf-cc and remove -DTEST_NARROW_WRITES, then rebuild sed -i 's/-DTEST_NARROW_WRITES//' conf-cc make clean && make ``` -------------------------------- ### C Function Signatures: Bit-dependent Tests Source: https://context7.com/jnavila/memtester/llms.txt These tests identify bits affected by their neighboring values, often involving bit shifting or flipping patterns. ```c // Bit-dependent Tests - catch bits affected by neighboring values int test_checkerboard_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_bitspread_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_bitflip_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_walkbits0_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); int test_walkbits1_comparison(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count); ``` -------------------------------- ### C Function Signature: Stuck Address Test Source: https://context7.com/jnavila/memtester/llms.txt The stuck address test verifies memory addressing. It must pass before other tests are considered meaningful. ```c // Stuck Address Test - verifies memory addressing works correctly // Must pass before other tests are meaningful int test_stuck_address(unsigned long volatile *bufa, size_t count); ``` -------------------------------- ### Interpreting Memtester Exit Codes Source: https://context7.com/jnavila/memtester/llms.txt Memtester returns meaningful exit codes that can be used for scripting and automated testing. The exit code is a bitmask indicating the type of failures encountered. ```bash # Run memtester and check exit code sudo memtester 100M 1 exit_code=$? ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.