diff --git a/changelogs/fragments/darwin_pagesize.yml b/changelogs/fragments/darwin_pagesize.yml new file mode 100644 index 00000000000..fa1b9703449 --- /dev/null +++ b/changelogs/fragments/darwin_pagesize.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - facts - gather pagesize and calculate respective values depending upon architecture (https://github.com/ansible/ansible/issues/84773). diff --git a/lib/ansible/module_utils/facts/hardware/darwin.py b/lib/ansible/module_utils/facts/hardware/darwin.py index ac159d5fd2b..419f13d5730 100644 --- a/lib/ansible/module_utils/facts/hardware/darwin.py +++ b/lib/ansible/module_utils/facts/hardware/darwin.py @@ -94,6 +94,8 @@ class DarwinHardware(Hardware): total_used = 0 page_size = 4096 + if 'hw.pagesize' in self.sysctl: + page_size = int(self.sysctl['hw.pagesize']) vm_stat_command = self.module.get_bin_path('vm_stat') if vm_stat_command is None: diff --git a/test/units/module_utils/facts/hardware/fixtures/sysctl_darwin_intel.txt b/test/units/module_utils/facts/hardware/fixtures/sysctl_darwin_intel.txt new file mode 100644 index 00000000000..b59b0a9fb4f --- /dev/null +++ b/test/units/module_utils/facts/hardware/fixtures/sysctl_darwin_intel.txt @@ -0,0 +1,626 @@ +hw.ncpu: 1 +hw.byteorder: 1234 +hw.memsize: 2147483648 +hw.activecpu: 1 +hw.features.allows_security_research: 0 +hw.optional.floatingpoint: 1 +hw.optional.mmx: 1 +hw.optional.sse: 1 +hw.optional.sse2: 1 +hw.optional.sse3: 1 +hw.optional.supplementalsse3: 1 +hw.optional.sse4_1: 1 +hw.optional.sse4_2: 1 +hw.optional.x86_64: 1 +hw.optional.aes: 1 +hw.optional.avx1_0: 1 +hw.optional.rdrand: 1 +hw.optional.f16c: 1 +hw.optional.enfstrg: 0 +hw.optional.fma: 1 +hw.optional.avx2_0: 1 +hw.optional.bmi1: 1 +hw.optional.bmi2: 1 +hw.optional.rtm: 0 +hw.optional.hle: 0 +hw.optional.adx: 1 +hw.optional.mpx: 0 +hw.optional.sgx: 0 +hw.optional.avx512f: 0 +hw.optional.avx512cd: 0 +hw.optional.avx512dq: 0 +hw.optional.avx512bw: 0 +hw.optional.avx512vl: 0 +hw.optional.avx512ifma: 0 +hw.optional.avx512vbmi: 0 +hw.perflevel0.physicalcpu: 1 +hw.perflevel0.physicalcpu_max: 1 +hw.perflevel0.logicalcpu: 1 +hw.perflevel0.logicalcpu_max: 1 +hw.perflevel0.l1icachesize: 32768 +hw.perflevel0.l1dcachesize: 32768 +hw.perflevel0.l2cachesize: 262144 +hw.perflevel0.cpusperl2: 1 +hw.perflevel0.l3cachesize: 12582912 +hw.perflevel0.cpusperl3: 1 +hw.perflevel0.name: Standard +hw.physicalcpu: 1 +hw.physicalcpu_max: 1 +hw.logicalcpu: 1 +hw.logicalcpu_max: 1 +hw.cputype: 7 +hw.cpusubtype: 8 +hw.cpu64bit_capable: 1 +hw.cpufamily: 260141638 +hw.cpusubfamily: 0 +hw.cacheconfig: 1 1 1 1 0 0 0 0 0 0 +hw.cachesize: 2147483648 32768 262144 12582912 0 0 0 0 0 0 +hw.pagesize: 4096 +hw.pagesize32: 4096 +hw.busfrequency: 400000000 +hw.busfrequency_min: 400000000 +hw.busfrequency_max: 400000000 +hw.cpufrequency: 3192000000 +hw.cpufrequency_min: 3192000000 +hw.cpufrequency_max: 3192000000 +hw.cachelinesize: 64 +hw.l1icachesize: 32768 +hw.l1dcachesize: 32768 +hw.l2cachesize: 262144 +hw.l3cachesize: 12582912 +hw.tbfrequency: 1000000000 +hw.memsize_usable: 2147483648 +hw.packages: 1 +hw.use_kernelmanagerd: 1 +hw.serialdebugmode: 0 +hw.nperflevels: 1 +hw.targettype: Mac +machdep.cpu.mwait.linesize_min: 4096 +machdep.cpu.mwait.linesize_max: 4096 +machdep.cpu.mwait.extensions: 3 +machdep.cpu.mwait.sub_Cstates: 544 +machdep.cpu.thermal.sensor: 1 +machdep.cpu.thermal.dynamic_acceleration: 0 +machdep.cpu.thermal.invariant_APIC_timer: 1 +machdep.cpu.thermal.thresholds: 2 +machdep.cpu.thermal.ACNT_MCNT: 0 +machdep.cpu.thermal.core_power_limits: 1 +machdep.cpu.thermal.fine_grain_clock_mod: 0 +machdep.cpu.thermal.package_thermal_intr: 1 +machdep.cpu.thermal.hardware_feedback: 0 +machdep.cpu.thermal.energy_policy: 0 +machdep.cpu.xsave.extended_state: 7 832 832 0 +machdep.cpu.xsave.extended_state1: 3 832 0 0 +machdep.cpu.arch_perf.version: 0 +machdep.cpu.arch_perf.number: 0 +machdep.cpu.arch_perf.width: 0 +machdep.cpu.arch_perf.events_number: 0 +machdep.cpu.arch_perf.events: 127 +machdep.cpu.arch_perf.fixed_number: 0 +machdep.cpu.arch_perf.fixed_width: 0 +machdep.cpu.cache.linesize: 64 +machdep.cpu.cache.L2_associativity: 4 +machdep.cpu.cache.size: 256 +machdep.cpu.tlb.inst.large: 8 +machdep.cpu.tlb.data.small: 64 +machdep.cpu.tlb.data.small_level1: 64 +machdep.cpu.address_bits.physical: 36 +machdep.cpu.address_bits.virtual: 48 +machdep.cpu.tsc_ccc.numerator: 266 +machdep.cpu.tsc_ccc.denominator: 2 +machdep.cpu.max_basic: 22 +machdep.cpu.max_ext: 2147483656 +machdep.cpu.vendor: GenuineIntel +machdep.cpu.brand_string: Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz +machdep.cpu.family: 6 +machdep.cpu.model: 158 +machdep.cpu.extmodel: 9 +machdep.cpu.extfamily: 0 +machdep.cpu.stepping: 10 +machdep.cpu.feature_bits: 18445110247204584447 +machdep.cpu.leaf7_feature_bits: 9177003 0 +machdep.cpu.extfeature_bits: 1241917688064 +machdep.cpu.signature: 591594 +machdep.cpu.brand: 0 +machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 SS HTT SSE3 PCLMULQDQ MON SSSE3 FMA CX16 SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES VMM PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C +machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 SMEP BMI2 ERMS INVPCID RDSEED ADX CLFSOPT +machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI +machdep.cpu.logical_per_package: 1 +machdep.cpu.cores_per_package: 1 +machdep.cpu.microcode_version: 0 +machdep.cpu.processor_flag: 0 +machdep.cpu.core_count: 1 +machdep.cpu.thread_count: 1 +machdep.vectors.timer: 221 +machdep.vectors.IPI: 222 +machdep.pmap.hashwalks: 180458 +machdep.pmap.hashcnts: 350467 +machdep.pmap.hashmax: 30 +machdep.pmap.kernel_text_ps: 4096 +machdep.pmap.kern_pv_reserve: 2000 +machdep.memmap.Conventional: 2127908864 +machdep.memmap.RuntimeServices: 3276800 +machdep.memmap.ACPIReclaim: 57344 +machdep.memmap.ACPINVS: 36864 +machdep.memmap.PalCode: 0 +machdep.memmap.Reserved: 16384 +machdep.memmap.Unusable: 0 +machdep.memmap.Other: 0 +machdep.tsc.nanotime.tsc_base: 8468213208 +machdep.tsc.nanotime.ns_base: 0 +machdep.tsc.nanotime.scale: 1345541132 +machdep.tsc.nanotime.shift: 0 +machdep.tsc.nanotime.generation: 2 +machdep.tsc.frequency: 3192000000 +machdep.tsc.deep_idle_rebase: 1 +machdep.tsc.at_boot: 0 +machdep.tsc.rebase_abs_time: 2652942998 +machdep.misc.fast_uexc_support: 1 +machdep.misc.panic_restart_timeout: 2147483647 +machdep.misc.interrupt_latency_max: 0x0 0x73 0x68bd52 +machdep.misc.timer_queue_trace: +machdep.misc.nmis: 0 +machdep.xcpm.mode: 0 +machdep.xcpm.pcps_mode: 0 +machdep.xcpm.hard_plimit_max_100mhz_ratio: 0 +machdep.xcpm.hard_plimit_min_100mhz_ratio: 0 +machdep.xcpm.soft_plimit_max_100mhz_ratio: 0 +machdep.xcpm.soft_plimit_min_100mhz_ratio: 0 +machdep.xcpm.tuib_plimit_max_100mhz_ratio: 0 +machdep.xcpm.tuib_plimit_min_100mhz_ratio: 0 +machdep.xcpm.lpm_plimit_max_100mhz_ratio: 0 +machdep.xcpm.tuib_enabled: 0 +machdep.xcpm.lpm_enabled: 0 +machdep.xcpm.power_source: 0 +machdep.xcpm.bootplim: 0 +machdep.xcpm.bootpst: 0 +machdep.xcpm.tuib_ns: 0 +machdep.xcpm.vectors_loaded_count: 0 +machdep.xcpm.ratio_change_ratelimit_ns: 500000 +machdep.xcpm.ratio_changes_total: 0 +machdep.xcpm.maxbusdelay: 0 +machdep.xcpm.maxintdelay: 0 +machdep.xcpm.mid_applications: 0 +machdep.xcpm.mid_relaxations: 0 +machdep.xcpm.mid_mode: 1 +machdep.xcpm.mid_cst_control_limit: 0 +machdep.xcpm.mid_mode_active: 0 +machdep.xcpm.mbd_mode: 1 +machdep.xcpm.mbd_applications: 0 +machdep.xcpm.mbd_relaxations: 0 +machdep.xcpm.forced_idle_ratio: 100 +machdep.xcpm.forced_idle_period: 30000000 +machdep.xcpm.deep_idle_log: 0 +machdep.xcpm.qos_txfr: 1 +machdep.xcpm.deep_idle_count: 0 +machdep.xcpm.deep_idle_last_stats: n/a +machdep.xcpm.deep_idle_total_stats: n/a +machdep.xcpm.cpu_thermal_level: 0 +machdep.xcpm.gpu_thermal_level: 0 +machdep.xcpm.io_thermal_level: 0 +machdep.xcpm.io_control_engages: 0 +machdep.xcpm.io_control_disengages: 0 +machdep.xcpm.io_filtered_reads: 0 +machdep.xcpm.pcps_rt_override_mode: 0 +machdep.xcpm.io_cst_control_enabled: 0 +machdep.xcpm.ring_boost_enabled: 0 +machdep.xcpm.io_epp_boost_enabled: 0 +machdep.xcpm.epp_override: 0 +machdep.xcpm.perf_hints: 0 +machdep.xcpm.pcps_rt_override_ns: 0 +machdep.x2apic_enabled: 1 +machdep.eager_timer_evaluations: 0 +machdep.eager_timer_evaluation_max: 0 +machdep.x86_fp_simd_isr_uses: 0 +machdep.user_idle_level: 0 +kern.ostype: Darwin +kern.osrelease: 23.3.0 +kern.osrevision: 199506 +kern.version: Darwin Kernel Version 23.3.0: Wed Dec 20 21:28:58 PST 2023; root:xnu-10002.81.5~7/RELEASE_X86_64 +kern.maxvnodes: 33792 +kern.maxproc: 1044 +kern.maxfiles: 30720 +kern.argmax: 1048576 +kern.securelevel: 0 +kern.hostname: localhost.local +kern.hostid: 0 +kern.clockrate: { hz = 100, tick = 10000, tickadj = 0, profhz = 100, stathz = 100 } +kern.posix1version: 200112 +kern.ngroups: 16 +kern.job_control: 1 +kern.saved_ids: 1 +kern.boottime: { sec = 1741191106, usec = 206725 } Wed Mar 5 16:11:46 2025 +kern.nisdomainname: +kern.maxfilesperproc: 10240 +kern.maxprocperuid: 522 +kern.ipc.maxsockbuf: 4194304 +kern.ipc.sockbuf_waste_factor: 8 +kern.ipc.somaxconn: 128 +kern.ipc.nmbclusters: 32768 +kern.ipc.soqlimitcompat: 1 +kern.ipc.io_policy.log: 0 +kern.ipc.io_policy.uuid: 1 +kern.ipc.mleak_sample_factor: 500 +kern.ipc.mb_normalized: 0 +kern.ipc.mb_watchdog: 1 +kern.ipc.mb_drain_force: 0 +kern.ipc.mb_drain_maxint: 0 +kern.ipc.mb_memory_pressure_percentage: 80 +kern.ipc.mb_uses_mcache: 1 +kern.ipc.mb_tag_mbuf: 1 +kern.ipc.socket_debug: 0 +kern.ipc.sosend_assert_panic: 0 +kern.ipc.sodefunct_calls: 0 +kern.ipc.sosendminchain: 16384 +kern.ipc.sorecvmincopy: 16384 +kern.ipc.sosendjcl: 1 +kern.ipc.sosendjcl_ignore_capab: 0 +kern.ipc.sosendbigcl_ignore_capab: 0 +kern.ipc.sodefunctlog: 0 +kern.ipc.sothrottlelog: 0 +kern.ipc.sorestrictrecv: 1 +kern.ipc.sorestrictsend: 1 +kern.ipc.soreserveheadroom: 1 +kern.ipc.maxextbkidleperproc: 1 +kern.ipc.extbkidletime: 600 +kern.ipc.extbkidlercvhiwat: 131072 +kern.ipc.sotcdb: 0 +kern.ipc.throttle_best_effort: 0 +kern.ipc.njcl: 10920 +kern.ipc.njclbytes: 16384 +kern.ipc.soqlencomp: 0 +kern.ipc.sbmb_cnt: 0 +kern.ipc.sbmb_cnt_peak: 4100 +kern.ipc.sbmb_cnt_floor: 0 +kern.ipc.sbmb_limreached: 0 +kern.ipc.maxsendmsgx: 256 +kern.ipc.maxrecvmsgx: 256 +kern.ipc.missingpktinfo: 0 +kern.ipc.do_recvmsg_x_donttrunc: 0 +kern.ipc.sendmsg_x_mode: 0 +kern.usrstack: -1198874624 +kern.netboot: 0 +kern.sysv.semmni: 87381 +kern.sysv.semmns: 87381 +kern.sysv.semmnu: 87381 +kern.sysv.semmsl: 87381 +kern.sysv.semume: 10 +kern.sysv.shmmax: 4194304 +kern.sysv.shmmin: 1 +kern.sysv.shmmni: 32 +kern.sysv.shmseg: 8 +kern.sysv.shmall: 1024 +kern.aiomax: 90 +kern.aioprocmax: 16 +kern.aiothreads: 4 +kern.corefile: /cores/core.%P +kern.coredump: 1 +kern.sugid_coredump: 0 +kern.delayterm: 0 +kern.shreg_private: 0 +kern.posix.sem.max: 10000 +kern.usrstack64: 140701929742336 +kern.tfp.policy: 2 +kern.procname: sysctl +kern.speculative_reads_disabled: 0 +kern.osversion: 23D60 +kern.safeboot: 0 +kern.rage_vnode: 0 +kern.tty.ptmx_max: 511 +kern.check_openevt: 0 +kern.threadname: +kern.timer.longterm.threshold: 1000 +kern.timer.longterm.scan_limit: 100000 +kern.timer.longterm.scan_interval: 100000 +kern.timer.longterm.qlen: 14 +kern.timer.longterm.scan_pauses: 0 +kern.timer.coalescing_enabled: 1 +kern.timer.deadline_tracking_bin_1: 2000000 +kern.timer.deadline_tracking_bin_2: 5000000 +kern.timer.scan_limit: 400000 +kern.timer.scan_interval: 40000 +kern.timer.scan_pauses: 33 +kern.timer.scan_postpones: 8 +kern.dtrace.err_verbose: 0 +kern.dtrace.buffer_memory_maxsize: 715827882 +kern.dtrace.buffer_memory_inuse: 0 +kern.dtrace.difo_maxsize: 262144 +kern.dtrace.dof_maxsize: 524288 +kern.dtrace.global_maxsize: 16384 +kern.dtrace.provide_private_probes: 1 +kern.dtrace.dof_mode: 1 +kern.dtrace.ignore_fbt_blacklist: 0 +kern.cpc.secure: 0 +kern.skywalk.flowswitch.rx_agg_tcp: 16384 +kern.skywalk.flowswitch.rx_agg_tcp_host: 2 +kern.skywalk.flowswitch.gso_mtu: 16384 +kern.skywalk.flowswitch.ip_reass: 2 +kern.skywalk.flowswitch.ipfm_frag_ttl: 60 +kern.skywalk.flowswitch.ipfm_timeout_tcall_ival: 1 +kern.skywalk.flowswitch.flow_route_expire: 600 +kern.skywalk.flowswitch.en0.ipfm.frag_limit: 800 +kern.skywalk.flowswitch.en0.ipfm.frag_count: 0 +kern.skywalk.flowswitch.en0.ipfm.queue_limit: 400 +kern.skywalk.flowswitch.en0.ipfm.queue_count: 0 +kern.skywalk.netif.netif_queue_stat_enable: 0 +kern.skywalk.netif.default_drop: 0 +kern.skywalk.ring_stat_enable: 0 +kern.microstackshot.interrupt_sample_rate: 1 +kern.microstackshot.pmi_sample_period: 0 +kern.microstackshot.pmi_sample_counter: 0 +kern.entropy.health.repetition_count_test.reset_count: 116356 +kern.entropy.health.repetition_count_test.failure_count: 0 +kern.entropy.health.repetition_count_test.max_observation_count: 3 +kern.entropy.health.adaptive_proportion_test.reset_count: 229 +kern.entropy.health.adaptive_proportion_test.failure_count: 0 +kern.entropy.health.adaptive_proportion_test.max_observation_count: 18 +kern.entropy.health.startup_done: 1 +kern.entropy.filter.total_sample_count: 116942 +kern.entropy.filter.accepted_sample_count: 116825 +kern.entropy.filter.rejected_sample_count: 117 +kern.entropy.analysis.supported: 0 +kern.kdbg.debug: 0 +kern.kdbg.oldest_time: 0 +kern.zleak.active: 0 +kern.zleak.zone_threshold: 100663296 +kern.monotonic.supported: 0 +kern.monotonic.pmis: 0 0 +kern.monotonic.retrograde_updates: 0 0 +kern.monotonic.task_thread_counting: 0 +kern.eventhandler.debug: 0 +kern.proc_rsr_in_progress: 0 +kern.hv_vmm_present: 1 +kern.secure_kernel: 0 +kern.interrupt_timer_coalescing_enabled: 1 +kern.timer_coalesce_idle_entry_hard_deadline_max: 5000000 +kern.willuserspacereboot: 0 +kern.hibernatefile: +kern.bootsignature: +kern.hibernatemode: 0 +kern.hibernategraphicsready: 0 +kern.hibernatewakenotification: 0 +kern.hibernatelockscreenready: 0 +kern.hibernatehidready: 0 +kern.hibernatecount: 0 +kern.nbuf: 10485 +kern.maxnbuf: 10485 +kern.flush_cache_on_write: 0 +kern.wq_stalled_window_usecs: 200 +kern.wq_reduce_pool_window_usecs: 5000000 +kern.wq_max_timer_interval_usecs: 50000 +kern.wq_max_threads: 512 +kern.wq_max_constrained_threads: 64 +kern.ds_supgroups_supported: 1 +kern.sugid_scripts: 0 +kern.libmalloc_experiments: 0 +kern.initproc_spawned: 1 +kern.uuid: 8C96896D-43A3-3BF0-8F4C-4118DA6AC9AA +kern.system_version_compat: 0 +kern.osproductversioncompat: 10.16 +kern.osproductversion: 14.3.1 +kern.osreleasetype: User +kern.iossupportversion: 17.3 +kern.bootargs: keepsyms=1 -serial=0x2 +kern.kernelcacheuuid: 2E5E0C48-9918-1669-2E36-1B3D717FF208 +kern.systemfilesetuuid: 68B91A95-FA62-3D42-CF55-A4E1FA6FA773 +kern.auxiliaryfilesetuuid: 5B5460EA-30C6-00E8-CE9F-9E905CC1C396 +kern.filesetuuid: 2E5E0C48-9918-1669-2E36-1B3D717FF208 +kern.num_files: 1403 +kern.num_vnodes: 33792 +kern.num_tasks: 1024 +kern.num_threads: 2560 +kern.num_taskthreads: 2560 +kern.num_recycledvnodes: 46195 +kern.free_vnodes: 20911 +kern.namecache_disabled: 0 +kern.sched_enable_smt: 1 +kern.sched_allow_NO_SMT_threads: 1 +kern.sched_rt_avoid_cpu0: 1 +kern.sched_recommended_cores: -1 +kern.suspend_cluster_powerdown: 0 +kern.preheat_max_bytes: 1048576 +kern.preheat_min_bytes: 32768 +kern.speculative_prefetch_max: 201326592 +kern.speculative_prefetch_max_iosize: 524288 +kern.vm_page_free_target: 4000 +kern.vm_page_free_min: 3500 +kern.vm_page_free_reserved: 897 +kern.vm_page_speculative_percentage: 5 +kern.vm_page_speculative_q_age_ms: 500 +kern.vm_max_delayed_work_limit: 32 +kern.vm_max_batch: 256 +kern.bootsessionuuid: 5C15808E-3D0F-42A5-975B-4F27CAE993C3 +kern.bootuuid: 48A39083-3D27-3FFD-91DE-5C31887AE2D5 +kern.apfsprebootuuid: 48A39083-3D27-3FFD-91DE-5C31887AE2D5 +kern.bootobjectspath: 48A39083-3D27-3FFD-91DE-5C31887AE2D5 +kern.drivercorefile: /private/var/dextcores/%N.core +kern.vfsnspace: 0 +kern.singleuser: 0 +kern.minimalboot: 0 +kern.affinity_sets_enabled: 1 +kern.affinity_sets_mapping: 1 +kern.slide: 1 +kern.ipc_voucher_trace_contents: 0 +kern.stack_size: 16384 +kern.stack_depth_max: 10144 +kern.kern_feature_overrides: 0 +kern.ipc_portbt: 0 +kern.ikm_signature_failures: 0 +kern.ikm_signature_failure_id: 0 +kern.sched: dualq +kern.cpu_checkin_interval: 5000 +kern.precise_user_kernel_time: 1 +kern.pervasive_energy: 0 +kern.timer_coalesce_bg_scale: -5 +kern.timer_resort_threshold_ns: 50000000 +kern.timer_coalesce_bg_ns_max: 100000000 +kern.timer_coalesce_kt_scale: 3 +kern.timer_coalesce_kt_ns_max: 1000000 +kern.timer_coalesce_fp_scale: 3 +kern.timer_coalesce_fp_ns_max: 1000000 +kern.timer_coalesce_ts_scale: 3 +kern.timer_coalesce_ts_ns_max: 1000000 +kern.timer_coalesce_tier0_scale: 3 +kern.timer_coalesce_tier0_ns_max: 1000000 +kern.timer_coalesce_tier1_scale: 2 +kern.timer_coalesce_tier1_ns_max: 5000000 +kern.timer_coalesce_tier2_scale: 1 +kern.timer_coalesce_tier2_ns_max: 20000000 +kern.timer_coalesce_tier3_scale: -2 +kern.timer_coalesce_tier3_ns_max: 75000000 +kern.timer_coalesce_tier4_scale: -15 +kern.timer_coalesce_tier4_ns_max: 10000000000 +kern.timer_coalesce_tier5_scale: -15 +kern.timer_coalesce_tier5_ns_max: 10000000000 +kern.hv_support: 0 +kern.hv_disable: 0 +kern.link_time_optimized: 1 +kern.thread_groups_supported: 0 +kern.direct_handoff: 1 +kern.num_static_scalable_counters: 48 +kern.trial_treatment_id: +kern.trial_experiment_id: +kern.trial_deployment_id: -1 +kern.page_protection_type: 0 +kern.exclaves_status: 255 +kern.memorystatus_sysprocs_idle_delay_time: 10 +kern.memorystatus_apps_idle_delay_time: 10 +kern.jetsam_aging_policy: 2 +kern.memorystatus_level: 78 +kern.memorystatus_purge_on_warning: 2 +kern.memorystatus_purge_on_urgent: 5 +kern.memorystatus_purge_on_critical: 8 +kern.vm_pressure_level_transition_threshold: 30 +kern.stackshot_estimate_adj: 75 +kern.msgbuf: 131072 +kern.task_exc_guard_default: 153 +kern.ulock_adaptive_spin_usecs: 20 +kern.consoleoptions: 0 +kern.aotmodebits: 0 +kern.aotmode: 0 +kern.pmtimeout: 0 +kern.pmcallouttimer: 2000 +kern.iokittest: 0 +kern.sleeptime: { sec = 0, usec = 0 } Thu Jan 1 00:00:00 1970 +kern.waketime: { sec = 0, usec = 0 } Thu Jan 1 00:00:00 1970 +kern.wake_abs_time: 0 +kern.sleep_abs_time: 0 +kern.useractive_abs_time: 560552999 +kern.userinactive_abs_time: 0 +kern.willshutdown: 0 +kern.progressmeterenable: 0 +kern.progressmeter: 342 +kern.prng.scheduled_reseed_count: 5 +kern.prng.scheduled_reseed_max_sample_count: 3895 +kern.prng.entropy_max_sample_count: 2311 +kern.prng.pool_0.sample_count: 0 +kern.prng.pool_0.drain_count: 5 +kern.prng.pool_0.max_sample_count: 2273 +kern.prng.pool_1.sample_count: 2763 +kern.prng.pool_1.drain_count: 2 +kern.prng.pool_1.max_sample_count: 2763 +kern.prng.pool_2.sample_count: 1972 +kern.prng.pool_2.drain_count: 1 +kern.prng.pool_2.max_sample_count: 2036 +kern.prng.pool_3.sample_count: 4389 +kern.prng.pool_3.drain_count: 0 +kern.prng.pool_3.max_sample_count: 4389 +kern.prng.pool_4.sample_count: 3084 +kern.prng.pool_4.drain_count: 0 +kern.prng.pool_4.max_sample_count: 3084 +kern.prng.pool_5.sample_count: 4726 +kern.prng.pool_5.drain_count: 0 +kern.prng.pool_5.max_sample_count: 4726 +kern.prng.pool_6.sample_count: 3861 +kern.prng.pool_6.drain_count: 0 +kern.prng.pool_6.max_sample_count: 3861 +kern.prng.pool_7.sample_count: 4239 +kern.prng.pool_7.drain_count: 0 +kern.prng.pool_7.max_sample_count: 4239 +kern.prng.pool_8.sample_count: 4809 +kern.prng.pool_8.drain_count: 0 +kern.prng.pool_8.max_sample_count: 4809 +kern.prng.pool_9.sample_count: 4085 +kern.prng.pool_9.drain_count: 0 +kern.prng.pool_9.max_sample_count: 4085 +kern.prng.pool_10.sample_count: 4638 +kern.prng.pool_10.drain_count: 0 +kern.prng.pool_10.max_sample_count: 4638 +kern.prng.pool_11.sample_count: 4268 +kern.prng.pool_11.drain_count: 0 +kern.prng.pool_11.max_sample_count: 4268 +kern.prng.pool_12.sample_count: 3995 +kern.prng.pool_12.drain_count: 0 +kern.prng.pool_12.max_sample_count: 3995 +kern.prng.pool_13.sample_count: 3216 +kern.prng.pool_13.drain_count: 0 +kern.prng.pool_13.max_sample_count: 3216 +kern.prng.pool_14.sample_count: 2387 +kern.prng.pool_14.drain_count: 0 +kern.prng.pool_14.max_sample_count: 2387 +kern.prng.pool_15.sample_count: 3694 +kern.prng.pool_15.drain_count: 0 +kern.prng.pool_15.max_sample_count: 3694 +kern.prng.pool_16.sample_count: 2626 +kern.prng.pool_16.drain_count: 0 +kern.prng.pool_16.max_sample_count: 2626 +kern.prng.pool_17.sample_count: 3114 +kern.prng.pool_17.drain_count: 0 +kern.prng.pool_17.max_sample_count: 3114 +kern.prng.pool_18.sample_count: 2424 +kern.prng.pool_18.drain_count: 0 +kern.prng.pool_18.max_sample_count: 2424 +kern.prng.pool_19.sample_count: 2795 +kern.prng.pool_19.drain_count: 0 +kern.prng.pool_19.max_sample_count: 2795 +kern.prng.pool_20.sample_count: 3182 +kern.prng.pool_20.drain_count: 0 +kern.prng.pool_20.max_sample_count: 3182 +kern.prng.pool_21.sample_count: 3858 +kern.prng.pool_21.drain_count: 0 +kern.prng.pool_21.max_sample_count: 3858 +kern.prng.pool_22.sample_count: 4579 +kern.prng.pool_22.drain_count: 0 +kern.prng.pool_22.max_sample_count: 4579 +kern.prng.pool_23.sample_count: 2720 +kern.prng.pool_23.drain_count: 0 +kern.prng.pool_23.max_sample_count: 2720 +kern.prng.pool_24.sample_count: 2375 +kern.prng.pool_24.drain_count: 0 +kern.prng.pool_24.max_sample_count: 2375 +kern.prng.pool_25.sample_count: 3328 +kern.prng.pool_25.drain_count: 0 +kern.prng.pool_25.max_sample_count: 3328 +kern.prng.pool_26.sample_count: 3282 +kern.prng.pool_26.drain_count: 0 +kern.prng.pool_26.max_sample_count: 3282 +kern.prng.pool_27.sample_count: 2549 +kern.prng.pool_27.drain_count: 0 +kern.prng.pool_27.max_sample_count: 2549 +kern.prng.pool_28.sample_count: 3215 +kern.prng.pool_28.drain_count: 0 +kern.prng.pool_28.max_sample_count: 3215 +kern.prng.pool_29.sample_count: 2872 +kern.prng.pool_29.drain_count: 0 +kern.prng.pool_29.max_sample_count: 2872 +kern.prng.pool_30.sample_count: 2702 +kern.prng.pool_30.drain_count: 0 +kern.prng.pool_30.max_sample_count: 2702 +kern.prng.pool_31.sample_count: 2683 +kern.prng.pool_31.drain_count: 0 +kern.prng.pool_31.max_sample_count: 2683 +kern.crypto.sha1: SHA1_VNG_INTEL_AVX2 +kern.crypto.sha256: SHA256_VNG_INTEL_AVX2 +kern.crypto.sha384: SHA384_VNG_INTEL_AVX2 +kern.crypto.sha512: SHA512_VNG_INTEL_AVX2 +kern.crypto.aes.ecb.encrypt: AES_ECB_INTEL_AESNI +kern.crypto.aes.ecb.decrypt: AES_ECB_INTEL_AESNI +kern.crypto.aes.xts.encrypt: AES_XTS_INTEL_AESNI +kern.crypto.aes.xts.decrypt: AES_XTS_INTEL_AESNI +kern.pthread_mutex_default_policy: 0 +kern.hv.vmx_mitigations: 0 +kern.hv.vmx_supported_mitigations: 32 +kern.hv.clock.tsc_base: 65825480984 +kern.hv.clock.tsc_clock_last: 0 +kern.hv.clock.generation: 1 +hw.model: Parallels20,1 diff --git a/test/units/module_utils/facts/hardware/fixtures/sysctl_darwin.txt b/test/units/module_utils/facts/hardware/fixtures/sysctl_darwin_silicon.txt similarity index 100% rename from test/units/module_utils/facts/hardware/fixtures/sysctl_darwin.txt rename to test/units/module_utils/facts/hardware/fixtures/sysctl_darwin_silicon.txt diff --git a/test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin_intel.txt b/test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin_intel.txt new file mode 100644 index 00000000000..da29ef34b24 --- /dev/null +++ b/test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin_intel.txt @@ -0,0 +1,23 @@ +Mach Virtual Memory Statistics: (page size of 4096 bytes) +Pages free: 24686. +Pages active: 150001. +Pages inactive: 224403. +Pages speculative: 16232. +Pages throttled: 0. +Pages wired down: 104517. +Pages purgeable: 17512. +"Translation faults": 1899905. +Pages copy-on-write: 79243. +Pages zero filled: 1121862. +Pages reactivated: 16323. +Pages purged: 808. +File-backed pages: 251947. +Anonymous pages: 138689. +Pages stored in compressor: 12487. +Pages occupied by compressor: 4244. +Decompressions: 6403. +Compressions: 19651. +Pageins: 81235. +Pageouts: 530. +Swapins: 0. +Swapouts: 0. diff --git a/test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin.txt b/test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin_silicon.txt similarity index 100% rename from test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin.txt rename to test/units/module_utils/facts/hardware/fixtures/vm_stat_darwin_silicon.txt diff --git a/test/units/module_utils/facts/hardware/test_darwin_facts.py b/test/units/module_utils/facts/hardware/test_darwin_facts.py index 432848b1c23..c06ac4bb1cf 100644 --- a/test/units/module_utils/facts/hardware/test_darwin_facts.py +++ b/test/units/module_utils/facts/hardware/test_darwin_facts.py @@ -5,15 +5,16 @@ from __future__ import annotations import pathlib +import pytest + from ansible.module_utils.facts.hardware import darwin from ansible.module_utils.facts.sysctl import get_sysctl -import pytest class TestDarwinHardwareFacts: - def _get_mock_sysctl_data(self): - fixtures = pathlib.Path(__file__).parent / "fixtures" - return (fixtures / "sysctl_darwin.txt").read_text() + def _get_mock_sysctl_data(self, filename="sysctl_darwin_silicon.txt"): + fixture_file = pathlib.Path(__file__).parent / "fixtures" / filename + return fixture_file.read_text() @pytest.fixture() def mocked_module(self, mocker, request): @@ -52,15 +53,32 @@ class TestDarwinHardwareFacts: } assert cpu_facts == expected_cpu_facts - def test_get_memory_facts(self, mocked_module): + @pytest.mark.parametrize( + ("vm_stat_file", "sysctl_file", "expected_memory_facts"), + [ + pytest.param( + "vm_stat_darwin_intel.txt", + "sysctl_darwin_intel.txt", + {'memtotal_mb': 2048, 'memfree_mb': 178}, + id="intel", + ), + pytest.param( + "vm_stat_darwin_silicon.txt", + "sysctl_darwin_silicon.txt", + {"memtotal_mb": 32768, "memfree_mb": 7660}, + id="silicon", + ), + ], + ) + def test_get_memory_facts(self, mocked_module, vm_stat_file, sysctl_file, expected_memory_facts): fixtures = pathlib.Path(__file__).parent / "fixtures" mocked_module.get_bin_path.side_effect = [ "/usr/sbin/sysctl", "/usr/bin/vm_stat", ] - mocked_vm_stat = (fixtures / "vm_stat_darwin.txt").read_text() + mocked_vm_stat = (fixtures / vm_stat_file).read_text() mocked_module.run_command.side_effect = [ - (0, self._get_mock_sysctl_data(), ""), + (0, self._get_mock_sysctl_data(filename=sysctl_file), ""), (0, mocked_vm_stat, ""), ] darwin_hardware = darwin.DarwinHardware(mocked_module) @@ -69,7 +87,6 @@ class TestDarwinHardwareFacts: ) memory_facts = darwin_hardware.get_memory_facts() - expected_memory_facts = {"memtotal_mb": 32768, "memfree_mb": 26491} assert memory_facts == expected_memory_facts def test_get_uptime_facts(self, mocked_module):