From 30ebb9ca3ac162f59758534bc3dfb5f69da1a11b Mon Sep 17 00:00:00 2001 From: WAKAYAMA Shirou Date: Wed, 15 Mar 2017 23:01:06 +0900 Subject: [PATCH] rename expected dir to testdata. --- cpu/cpu_freebsd_test.go | 2 +- cpu/cpu_solaris_test.go | 16 ++++----- cpu/expected/freebsd/1cpu_2core.txt | 43 ---------------------- cpu/expected/freebsd/1cpu_4core.txt | 38 -------------------- cpu/expected/freebsd/2cpu_4core.txt | 45 ------------------------ cpu/expected/solaris/1cpu_1core_isainfo.txt | 4 --- cpu/expected/solaris/1cpu_1core_psrinfo.txt | 3 -- cpu/expected/solaris/2cpu_1core_isainfo.txt | 4 --- cpu/expected/solaris/2cpu_1core_psrinfo.txt | 6 ---- cpu/expected/solaris/2cpu_8core_isainfo.txt | 3 -- cpu/expected/solaris/2cpu_8core_psrinfo.txt | 22 ------------ cpu/testdata/freebsd/1cpu_2core.txt | 43 ++++++++++++++++++++++ cpu/testdata/freebsd/1cpu_4core.txt | 38 ++++++++++++++++++++ cpu/testdata/freebsd/2cpu_4core.txt | 45 ++++++++++++++++++++++++ cpu/testdata/solaris/1cpu_1core_isainfo.txt | 4 +++ cpu/testdata/solaris/1cpu_1core_psrinfo.txt | 3 ++ cpu/testdata/solaris/2cpu_1core_isainfo.txt | 4 +++ cpu/testdata/solaris/2cpu_1core_psrinfo.txt | 6 ++++ cpu/testdata/solaris/2cpu_8core_isainfo.txt | 3 ++ cpu/testdata/solaris/2cpu_8core_psrinfo.txt | 22 ++++++++++++ internal/common/common.go | 20 +++++------ process/expected/darwin/%2Fbin%2Fps-ax-opid_fail | 10 ------ process/testdata/darwin/ps-ax-opid_fail | 10 ++++++ 23 files changed, 195 insertions(+), 199 deletions(-) delete mode 100644 cpu/expected/freebsd/1cpu_2core.txt delete mode 100644 cpu/expected/freebsd/1cpu_4core.txt delete mode 100644 cpu/expected/freebsd/2cpu_4core.txt delete mode 100644 cpu/expected/solaris/1cpu_1core_isainfo.txt delete mode 100644 cpu/expected/solaris/1cpu_1core_psrinfo.txt delete mode 100644 cpu/expected/solaris/2cpu_1core_isainfo.txt delete mode 100644 cpu/expected/solaris/2cpu_1core_psrinfo.txt delete mode 100644 cpu/expected/solaris/2cpu_8core_isainfo.txt delete mode 100644 cpu/expected/solaris/2cpu_8core_psrinfo.txt create mode 100644 cpu/testdata/freebsd/1cpu_2core.txt create mode 100644 cpu/testdata/freebsd/1cpu_4core.txt create mode 100644 cpu/testdata/freebsd/2cpu_4core.txt create mode 100644 cpu/testdata/solaris/1cpu_1core_isainfo.txt create mode 100644 cpu/testdata/solaris/1cpu_1core_psrinfo.txt create mode 100644 cpu/testdata/solaris/2cpu_1core_isainfo.txt create mode 100644 cpu/testdata/solaris/2cpu_1core_psrinfo.txt create mode 100644 cpu/testdata/solaris/2cpu_8core_isainfo.txt create mode 100644 cpu/testdata/solaris/2cpu_8core_psrinfo.txt delete mode 100644 process/expected/darwin/%2Fbin%2Fps-ax-opid_fail create mode 100644 process/testdata/darwin/ps-ax-opid_fail diff --git a/cpu/cpu_freebsd_test.go b/cpu/cpu_freebsd_test.go index bd20211..afa502a 100644 --- a/cpu/cpu_freebsd_test.go +++ b/cpu/cpu_freebsd_test.go @@ -23,7 +23,7 @@ func TestParseDmesgBoot(t *testing.T) { {"2cpu_4core.txt", 2, 4}, } for _, tt := range cpuTests { - v, num, err := parseDmesgBoot(filepath.Join("expected/freebsd/", tt.file)) + v, num, err := parseDmesgBoot(filepath.Join("testdatak", "freebsd", tt.file)) if err != nil { t.Errorf("parseDmesgBoot failed(%s), %v", tt.file, err) } diff --git a/cpu/cpu_solaris_test.go b/cpu/cpu_solaris_test.go index 96b98eb..b22d385 100644 --- a/cpu/cpu_solaris_test.go +++ b/cpu/cpu_solaris_test.go @@ -16,16 +16,16 @@ func TestParseISAInfo(t *testing.T) { { "1cpu_1core_isainfo.txt", []string{"rdseed", "adx", "avx2", "fma", "bmi2", "bmi1", "rdrand", "f16c", "vmx", - "avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt", - "tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8", - "tsc", "fpu"}, + "avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt", + "tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8", + "tsc", "fpu"}, }, { "2cpu_1core_isainfo.txt", []string{"rdseed", "adx", "avx2", "fma", "bmi2", "bmi1", "rdrand", "f16c", "vmx", - "avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt", - "tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8", - "tsc", "fpu"}, + "avx", "xsave", "pclmulqdq", "aes", "movbe", "sse4.2", "sse4.1", "ssse3", "popcnt", + "tscp", "cx16", "sse3", "sse2", "sse", "fxsr", "mmx", "cmov", "amd_sysc", "cx8", + "tsc", "fpu"}, }, { "2cpu_8core_isainfo.txt", @@ -36,7 +36,7 @@ func TestParseISAInfo(t *testing.T) { } for _, tc := range cases { - content, err := ioutil.ReadFile(filepath.Join("expected", "solaris", tc.filename)) + content, err := ioutil.ReadFile(filepath.Join("testdata", "solaris", tc.filename)) if err != nil { t.Errorf("cannot read test case: %s", err) } @@ -96,7 +96,7 @@ func TestParseProcessorInfo(t *testing.T) { } for _, tc := range cases { - content, err := ioutil.ReadFile(filepath.Join("expected", "solaris", tc.filename)) + content, err := ioutil.ReadFile(filepath.Join("testdata", "solaris", tc.filename)) if err != nil { t.Errorf("cannot read test case: %s", err) } diff --git a/cpu/expected/freebsd/1cpu_2core.txt b/cpu/expected/freebsd/1cpu_2core.txt deleted file mode 100644 index a5d9fec..0000000 --- a/cpu/expected/freebsd/1cpu_2core.txt +++ /dev/null @@ -1,43 +0,0 @@ -Copyright (c) 1992-2016 The FreeBSD Project. -Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 - The Regents of the University of California. All rights reserved. -FreeBSD is a registered trademark of The FreeBSD Foundation. -FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016 - root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 -FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) -VT(vga): resolution 640x480 -CPU: Intel(R) Core(TM) i3 CPU 550 @ 3.20GHz (3192.07-MHz K8-class CPU) - Origin="GenuineIntel" Id=0x20655 Family=0x6 Model=0x25 Stepping=5 - Features=0xbfebfbff - Features2=0x9ae3bd - AMD Features=0x28100800 - AMD Features2=0x1 - VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID - TSC: P-state invariant, performance statistics -real memory = 8589934592 (8192 MB) -avail memory = 8046452736 (7673 MB) -Event timer "LAPIC" quality 600 -ACPI APIC Table: -FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs -FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads -random: unblocking device. -ioapic0 irqs 0-23 on motherboard -random: entropy device external interface -kbd1 at kbdmux0 -netmap: loaded module -module_register_init: MOD_LOAD (vesa, 0xffffffff8101c970, 0) error 19 -vtvga0: on motherboard -cryptosoft0: on motherboard -aesni0: No AESNI support. -acpi0: on motherboard -acpi0: Power Button (fixed) -cpu0: on acpi0 -ACPI BIOS Warning (bug): Incorrect checksum in table [SSDT] - 0x3F, should be 0x1F (20160527/tbprint-229) -cpu1: on acpi0 -cpu2: on acpi0 -cpu3: on acpi0 -attimer0: port 0x40-0x43 irq 0 on acpi0 -Timecounter "i8254" frequency 1193182 Hz quality 0 -Event timer "i8254" frequency 1193182 Hz quality 100 -atrtc0: port 0x70-0x71 irq 8 on acpi0 -Event timer "RTC" frequency 32768 Hz quality 0 \ No newline at end of file diff --git a/cpu/expected/freebsd/1cpu_4core.txt b/cpu/expected/freebsd/1cpu_4core.txt deleted file mode 100644 index 2a49823..0000000 --- a/cpu/expected/freebsd/1cpu_4core.txt +++ /dev/null @@ -1,38 +0,0 @@ -Copyright (c) 1992-2016 The FreeBSD Project. -Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 - The Regents of the University of California. All rights reserved. -FreeBSD is a registered trademark of The FreeBSD Foundation. -FreeBSD 10.3-RELEASE-p4 #0: Sat May 28 12:23:44 UTC 2016 - root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 -FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 -CPU: Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz (3700.09-MHz K8-class CPU) - Origin="GenuineIntel" Id=0x306e4 Family=0x6 Model=0x3e Stepping=4 - Features=0xbfebfbff - Features2=0x7fbee3ff - AMD Features=0x2c100800 - AMD Features2=0x1 - Structured Extended Features=0x281 - XSAVE Features=0x1 - VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr - TSC: P-state invariant, performance statistics -real memory = 34368126976 (32776 MB) -avail memory = 33228333056 (31689 MB) -Event timer "LAPIC" quality 600 -ACPI APIC Table: < > -FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs -FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 SMT threads - cpu0 (BSP): APIC ID: 0 - cpu1 (AP): APIC ID: 1 - cpu2 (AP): APIC ID: 2 - cpu3 (AP): APIC ID: 3 - cpu4 (AP): APIC ID: 4 - cpu5 (AP): APIC ID: 5 - cpu6 (AP): APIC ID: 6 - cpu7 (AP): APIC ID: 7 -random: initialized -ioapic0 irqs 0-23 on motherboard -ioapic1 irqs 24-47 on motherboard -kbd1 at kbdmux0 -cryptosoft0: on motherboard -aesni0: on motherboard -acpi0: on motherboard \ No newline at end of file diff --git a/cpu/expected/freebsd/2cpu_4core.txt b/cpu/expected/freebsd/2cpu_4core.txt deleted file mode 100644 index b274cc4..0000000 --- a/cpu/expected/freebsd/2cpu_4core.txt +++ /dev/null @@ -1,45 +0,0 @@ -Copyright (c) 1992-2011 The FreeBSD Project. -Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 - The Regents of the University of California. All rights reserved. -FreeBSD is a registered trademark of The FreeBSD Foundation. -FreeBSD 8.2-RELEASE #1: Sat Mar 5 23:03:14 CET 2011 - root@host1:/usr/obj/usr/src/sys/MYKERNEL amd64 -Timecounter "i8254" frequency 1193182 Hz quality 0 -CPU: Intel(R) Xeon(R) CPU E5420 @ 2.50GHz (2500.11-MHz K8-class CPU) - Origin = "GenuineIntel" Id = 0x10676 Family = 6 Model = 17 Stepping = 6 - Features=0xbfebfbff - Features2=0xce3bd - AMD Features=0x20100800 - AMD Features2=0x1 - TSC: P-state invariant -real memory = 17179869184 (16384 MB) -avail memory = 16531587072 (15765 MB) -ACPI APIC Table: -FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs -FreeBSD/SMP: 2 package(s) x 4 core(s) - cpu0 (BSP): APIC ID: 0 - cpu1 (AP): APIC ID: 1 - cpu2 (AP): APIC ID: 2 - cpu3 (AP): APIC ID: 3 - cpu4 (AP): APIC ID: 4 - cpu5 (AP): APIC ID: 5 - cpu6 (AP): APIC ID: 6 - cpu7 (AP): APIC ID: 7 -ioapic0 irqs 0-23 on motherboard -ioapic1 irqs 24-47 on motherboard -kbd1 at kbdmux0 -acpi0: on motherboard -acpi0: [ITHREAD] -acpi0: Power Button (fixed) -unknown: I/O range not supported -Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000 -acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 -cpu0: on acpi0 -cpu1: on acpi0 -cpu2: on acpi0 -cpu3: on acpi0 -cpu4: on acpi0 -cpu5: on acpi0 -cpu6: on acpi0 -cpu7: on acpi0 -pcib0: port 0xcf8-0xcff on acpi0 \ No newline at end of file diff --git a/cpu/expected/solaris/1cpu_1core_isainfo.txt b/cpu/expected/solaris/1cpu_1core_isainfo.txt deleted file mode 100644 index 4a804df..0000000 --- a/cpu/expected/solaris/1cpu_1core_isainfo.txt +++ /dev/null @@ -1,4 +0,0 @@ -64-bit amd64 applications - rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq - aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr - mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/expected/solaris/1cpu_1core_psrinfo.txt b/cpu/expected/solaris/1cpu_1core_psrinfo.txt deleted file mode 100644 index 0daaabf..0000000 --- a/cpu/expected/solaris/1cpu_1core_psrinfo.txt +++ /dev/null @@ -1,3 +0,0 @@ -The physical processor has 1 virtual processor (0) - x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) - Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz \ No newline at end of file diff --git a/cpu/expected/solaris/2cpu_1core_isainfo.txt b/cpu/expected/solaris/2cpu_1core_isainfo.txt deleted file mode 100644 index 4a804df..0000000 --- a/cpu/expected/solaris/2cpu_1core_isainfo.txt +++ /dev/null @@ -1,4 +0,0 @@ -64-bit amd64 applications - rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq - aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr - mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/expected/solaris/2cpu_1core_psrinfo.txt b/cpu/expected/solaris/2cpu_1core_psrinfo.txt deleted file mode 100644 index 1de8a17..0000000 --- a/cpu/expected/solaris/2cpu_1core_psrinfo.txt +++ /dev/null @@ -1,6 +0,0 @@ -The physical processor has 1 virtual processor (0) - x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) - Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz -The physical processor has 1 virtual processor (1) - x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) - Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz \ No newline at end of file diff --git a/cpu/expected/solaris/2cpu_8core_isainfo.txt b/cpu/expected/solaris/2cpu_8core_isainfo.txt deleted file mode 100644 index d291ad3..0000000 --- a/cpu/expected/solaris/2cpu_8core_isainfo.txt +++ /dev/null @@ -1,3 +0,0 @@ -64-bit amd64 applications - vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16 - sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/expected/solaris/2cpu_8core_psrinfo.txt b/cpu/expected/solaris/2cpu_8core_psrinfo.txt deleted file mode 100644 index 36b3998..0000000 --- a/cpu/expected/solaris/2cpu_8core_psrinfo.txt +++ /dev/null @@ -1,22 +0,0 @@ -The physical processor has 8 cores and 16 virtual processors (0-7 16-23) - The core has 2 virtual processors (0 16) - The core has 2 virtual processors (1 17) - The core has 2 virtual processors (2 18) - The core has 2 virtual processors (3 19) - The core has 2 virtual processors (4 20) - The core has 2 virtual processors (5 21) - The core has 2 virtual processors (6 22) - The core has 2 virtual processors (7 23) - x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz) - Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz -The physical processor has 8 cores and 16 virtual processors (8-15 24-31) - The core has 2 virtual processors (8 24) - The core has 2 virtual processors (9 25) - The core has 2 virtual processors (10 26) - The core has 2 virtual processors (11 27) - The core has 2 virtual processors (12 28) - The core has 2 virtual processors (13 29) - The core has 2 virtual processors (14 30) - The core has 2 virtual processors (15 31) - x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz) - Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz \ No newline at end of file diff --git a/cpu/testdata/freebsd/1cpu_2core.txt b/cpu/testdata/freebsd/1cpu_2core.txt new file mode 100644 index 0000000..a5d9fec --- /dev/null +++ b/cpu/testdata/freebsd/1cpu_2core.txt @@ -0,0 +1,43 @@ +Copyright (c) 1992-2016 The FreeBSD Project. +Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 + The Regents of the University of California. All rights reserved. +FreeBSD is a registered trademark of The FreeBSD Foundation. +FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016 + root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 +FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) +VT(vga): resolution 640x480 +CPU: Intel(R) Core(TM) i3 CPU 550 @ 3.20GHz (3192.07-MHz K8-class CPU) + Origin="GenuineIntel" Id=0x20655 Family=0x6 Model=0x25 Stepping=5 + Features=0xbfebfbff + Features2=0x9ae3bd + AMD Features=0x28100800 + AMD Features2=0x1 + VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID + TSC: P-state invariant, performance statistics +real memory = 8589934592 (8192 MB) +avail memory = 8046452736 (7673 MB) +Event timer "LAPIC" quality 600 +ACPI APIC Table: +FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs +FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads +random: unblocking device. +ioapic0 irqs 0-23 on motherboard +random: entropy device external interface +kbd1 at kbdmux0 +netmap: loaded module +module_register_init: MOD_LOAD (vesa, 0xffffffff8101c970, 0) error 19 +vtvga0: on motherboard +cryptosoft0: on motherboard +aesni0: No AESNI support. +acpi0: on motherboard +acpi0: Power Button (fixed) +cpu0: on acpi0 +ACPI BIOS Warning (bug): Incorrect checksum in table [SSDT] - 0x3F, should be 0x1F (20160527/tbprint-229) +cpu1: on acpi0 +cpu2: on acpi0 +cpu3: on acpi0 +attimer0: port 0x40-0x43 irq 0 on acpi0 +Timecounter "i8254" frequency 1193182 Hz quality 0 +Event timer "i8254" frequency 1193182 Hz quality 100 +atrtc0: port 0x70-0x71 irq 8 on acpi0 +Event timer "RTC" frequency 32768 Hz quality 0 \ No newline at end of file diff --git a/cpu/testdata/freebsd/1cpu_4core.txt b/cpu/testdata/freebsd/1cpu_4core.txt new file mode 100644 index 0000000..2a49823 --- /dev/null +++ b/cpu/testdata/freebsd/1cpu_4core.txt @@ -0,0 +1,38 @@ +Copyright (c) 1992-2016 The FreeBSD Project. +Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 + The Regents of the University of California. All rights reserved. +FreeBSD is a registered trademark of The FreeBSD Foundation. +FreeBSD 10.3-RELEASE-p4 #0: Sat May 28 12:23:44 UTC 2016 + root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 +FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 +CPU: Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz (3700.09-MHz K8-class CPU) + Origin="GenuineIntel" Id=0x306e4 Family=0x6 Model=0x3e Stepping=4 + Features=0xbfebfbff + Features2=0x7fbee3ff + AMD Features=0x2c100800 + AMD Features2=0x1 + Structured Extended Features=0x281 + XSAVE Features=0x1 + VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr + TSC: P-state invariant, performance statistics +real memory = 34368126976 (32776 MB) +avail memory = 33228333056 (31689 MB) +Event timer "LAPIC" quality 600 +ACPI APIC Table: < > +FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs +FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 SMT threads + cpu0 (BSP): APIC ID: 0 + cpu1 (AP): APIC ID: 1 + cpu2 (AP): APIC ID: 2 + cpu3 (AP): APIC ID: 3 + cpu4 (AP): APIC ID: 4 + cpu5 (AP): APIC ID: 5 + cpu6 (AP): APIC ID: 6 + cpu7 (AP): APIC ID: 7 +random: initialized +ioapic0 irqs 0-23 on motherboard +ioapic1 irqs 24-47 on motherboard +kbd1 at kbdmux0 +cryptosoft0: on motherboard +aesni0: on motherboard +acpi0: on motherboard \ No newline at end of file diff --git a/cpu/testdata/freebsd/2cpu_4core.txt b/cpu/testdata/freebsd/2cpu_4core.txt new file mode 100644 index 0000000..b274cc4 --- /dev/null +++ b/cpu/testdata/freebsd/2cpu_4core.txt @@ -0,0 +1,45 @@ +Copyright (c) 1992-2011 The FreeBSD Project. +Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 + The Regents of the University of California. All rights reserved. +FreeBSD is a registered trademark of The FreeBSD Foundation. +FreeBSD 8.2-RELEASE #1: Sat Mar 5 23:03:14 CET 2011 + root@host1:/usr/obj/usr/src/sys/MYKERNEL amd64 +Timecounter "i8254" frequency 1193182 Hz quality 0 +CPU: Intel(R) Xeon(R) CPU E5420 @ 2.50GHz (2500.11-MHz K8-class CPU) + Origin = "GenuineIntel" Id = 0x10676 Family = 6 Model = 17 Stepping = 6 + Features=0xbfebfbff + Features2=0xce3bd + AMD Features=0x20100800 + AMD Features2=0x1 + TSC: P-state invariant +real memory = 17179869184 (16384 MB) +avail memory = 16531587072 (15765 MB) +ACPI APIC Table: +FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs +FreeBSD/SMP: 2 package(s) x 4 core(s) + cpu0 (BSP): APIC ID: 0 + cpu1 (AP): APIC ID: 1 + cpu2 (AP): APIC ID: 2 + cpu3 (AP): APIC ID: 3 + cpu4 (AP): APIC ID: 4 + cpu5 (AP): APIC ID: 5 + cpu6 (AP): APIC ID: 6 + cpu7 (AP): APIC ID: 7 +ioapic0 irqs 0-23 on motherboard +ioapic1 irqs 24-47 on motherboard +kbd1 at kbdmux0 +acpi0: on motherboard +acpi0: [ITHREAD] +acpi0: Power Button (fixed) +unknown: I/O range not supported +Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000 +acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 +cpu0: on acpi0 +cpu1: on acpi0 +cpu2: on acpi0 +cpu3: on acpi0 +cpu4: on acpi0 +cpu5: on acpi0 +cpu6: on acpi0 +cpu7: on acpi0 +pcib0: port 0xcf8-0xcff on acpi0 \ No newline at end of file diff --git a/cpu/testdata/solaris/1cpu_1core_isainfo.txt b/cpu/testdata/solaris/1cpu_1core_isainfo.txt new file mode 100644 index 0000000..4a804df --- /dev/null +++ b/cpu/testdata/solaris/1cpu_1core_isainfo.txt @@ -0,0 +1,4 @@ +64-bit amd64 applications + rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq + aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr + mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/testdata/solaris/1cpu_1core_psrinfo.txt b/cpu/testdata/solaris/1cpu_1core_psrinfo.txt new file mode 100644 index 0000000..0daaabf --- /dev/null +++ b/cpu/testdata/solaris/1cpu_1core_psrinfo.txt @@ -0,0 +1,3 @@ +The physical processor has 1 virtual processor (0) + x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) + Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz \ No newline at end of file diff --git a/cpu/testdata/solaris/2cpu_1core_isainfo.txt b/cpu/testdata/solaris/2cpu_1core_isainfo.txt new file mode 100644 index 0000000..4a804df --- /dev/null +++ b/cpu/testdata/solaris/2cpu_1core_isainfo.txt @@ -0,0 +1,4 @@ +64-bit amd64 applications + rdseed adx avx2 fma bmi2 bmi1 rdrand f16c vmx avx xsave pclmulqdq + aes movbe sse4.2 sse4.1 ssse3 popcnt tscp cx16 sse3 sse2 sse fxsr + mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/testdata/solaris/2cpu_1core_psrinfo.txt b/cpu/testdata/solaris/2cpu_1core_psrinfo.txt new file mode 100644 index 0000000..1de8a17 --- /dev/null +++ b/cpu/testdata/solaris/2cpu_1core_psrinfo.txt @@ -0,0 +1,6 @@ +The physical processor has 1 virtual processor (0) + x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) + Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz +The physical processor has 1 virtual processor (1) + x86 (GenuineIntel 406E3 family 6 model 78 step 3 clock 3312 MHz) + Intel(r) Core(tm) i7-6567U CPU @ 3.30GHz \ No newline at end of file diff --git a/cpu/testdata/solaris/2cpu_8core_isainfo.txt b/cpu/testdata/solaris/2cpu_8core_isainfo.txt new file mode 100644 index 0000000..d291ad3 --- /dev/null +++ b/cpu/testdata/solaris/2cpu_8core_isainfo.txt @@ -0,0 +1,3 @@ +64-bit amd64 applications + vmx avx xsave pclmulqdq aes sse4.2 sse4.1 ssse3 popcnt tscp cx16 + sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu \ No newline at end of file diff --git a/cpu/testdata/solaris/2cpu_8core_psrinfo.txt b/cpu/testdata/solaris/2cpu_8core_psrinfo.txt new file mode 100644 index 0000000..36b3998 --- /dev/null +++ b/cpu/testdata/solaris/2cpu_8core_psrinfo.txt @@ -0,0 +1,22 @@ +The physical processor has 8 cores and 16 virtual processors (0-7 16-23) + The core has 2 virtual processors (0 16) + The core has 2 virtual processors (1 17) + The core has 2 virtual processors (2 18) + The core has 2 virtual processors (3 19) + The core has 2 virtual processors (4 20) + The core has 2 virtual processors (5 21) + The core has 2 virtual processors (6 22) + The core has 2 virtual processors (7 23) + x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz) + Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz +The physical processor has 8 cores and 16 virtual processors (8-15 24-31) + The core has 2 virtual processors (8 24) + The core has 2 virtual processors (9 25) + The core has 2 virtual processors (10 26) + The core has 2 virtual processors (11 27) + The core has 2 virtual processors (12 28) + The core has 2 virtual processors (13 29) + The core has 2 virtual processors (14 30) + The core has 2 virtual processors (15 31) + x86 (GenuineIntel 206D7 family 6 model 45 step 7 clock 2600 MHz) + Intel(r) Xeon(r) CPU E5-2670 0 @ 2.60GHz \ No newline at end of file diff --git a/internal/common/common.go b/internal/common/common.go index 9ad4264..cb6d3f3 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -10,6 +10,7 @@ import ( "bufio" "bytes" "errors" + "fmt" "io/ioutil" "log" "net/url" @@ -41,9 +42,8 @@ func (i Invoke) Command(name string, arg ...string) ([]byte, error) { } type FakeInvoke struct { - CommandExpectedDir string // CommandExpectedDir specifies dir which includes expected outputs. - Suffix string // Suffix species expected file name suffix such as "fail" - Error error // If Error specfied, return the error. + Suffix string // Suffix species expected file name suffix such as "fail" + Error error // If Error specfied, return the error. } // Command in FakeInvoke returns from expected file if exists. @@ -54,22 +54,18 @@ func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) { arch := runtime.GOOS - fname := strings.Join(append([]string{name}, arg...), "") + commandName := filepath.Base(name) + + fname := strings.Join(append([]string{commandName}, arg...), "") fname = url.QueryEscape(fname) - var dir string - if i.CommandExpectedDir == "" { - dir = "expected" - } else { - dir = i.CommandExpectedDir - } - fpath := path.Join(dir, arch, fname) + fpath := path.Join("testdata", arch, fname) if i.Suffix != "" { fpath += "_" + i.Suffix } if PathExists(fpath) { return ioutil.ReadFile(fpath) } - return exec.Command(name, arg...).Output() + return []byte{}, fmt.Errorf("could not find testdata: %s", fpath) } var ErrNotImplementedError = errors.New("not implemented yet") diff --git a/process/expected/darwin/%2Fbin%2Fps-ax-opid_fail b/process/expected/darwin/%2Fbin%2Fps-ax-opid_fail deleted file mode 100644 index fce59ef..0000000 --- a/process/expected/darwin/%2Fbin%2Fps-ax-opid_fail +++ /dev/null @@ -1,10 +0,0 @@ - PID - 245 - 247 - 248 - 249 - 254 - 262 - 264 - 265 - 267 diff --git a/process/testdata/darwin/ps-ax-opid_fail b/process/testdata/darwin/ps-ax-opid_fail new file mode 100644 index 0000000..fce59ef --- /dev/null +++ b/process/testdata/darwin/ps-ax-opid_fail @@ -0,0 +1,10 @@ + PID + 245 + 247 + 248 + 249 + 254 + 262 + 264 + 265 + 267