Darwin

09、自动执行

大兔子大兔子 提交于 2019-11-30 14:26:53
除了使用pytest.fixture.userfixtures和传参两种显式的调用fixture之外.也可以自动的执行fixture,在定义fixture的时候设置autouser=True即可 from datetime import datetime from time import sleep import pytest @pytest.fixture(autouse=True) def timer_session_scope(): start = datetime.now() print(f"\nstart:{start}") yield end = datetime.now() print(f"total time cost:{end - start}") def test_timer(): sleep(1.3) assert 2 == 2 运行结果: ╰ pytest -v -s test_data.py ======================================================= test session starts ======================================================== platform darwin -- Python 3.7.4, pytest-4.4.0, py-1

How can I use mach_absolute_time without overflowing?

你说的曾经没有我的故事 提交于 2019-11-30 06:59:44
问题 On Darwin, the POSIX standard clock_gettime(CLOCK_MONOTONIC) timer is not available. Instead, the highest resolution monotonic timer is obtained through the mach_absolute_time function from mach/mach_time.h . The result returned may be an unadjusted tick count from the processor, in which case the time units could be a strange multiple. For example, on a CPU with a 33MHz tick count, Darwin returns 1000000000/33333335 as the exact units of the returned result (ie, multiply the mach_absolute

How to enable C++17 on Mac?

痴心易碎 提交于 2019-11-30 04:54:33
I am able to update gcc on Linux to get -std=c++17 but cannot do the same on Mac. Is there a version of Clang I can update to or some other alternative to get C++17 on my Mac? Please help. Thanks. On my 10.11 El Capitan, Xcode 7.3.1, clang has been updated to: Apple LLVM version 7.3.0 (clang-703.0.31) which is almost equivalent to llvm version 3.8. clang++ hasn't -std=c++17 option, but -std=c++1z , working well at present, though only supporting some features of C++1z. For gcc, you can install a very new one by: brew install gcc --HEAD which will install gcc-6.1 now, (2016.8). This gcc has

Using Rsync include and exclude options to include directory and file by pattern

戏子无情 提交于 2019-11-29 19:56:50
I'm having problems getting my rsync syntax right and I'm wondering if my scenario can actually be handled with rsync. First, I've confirmed that rsync is working just fine between my local host and my remote host. Doing a straight sync on a directory is successful. Here's what my filesystem looks like: uploads/ 1260000000/ file_11_00.jpg file_11_01.jpg file_12_00.jpg 1270000000/ file_11_00.jpg file_11_01.jpg file_12_00.jpg 1280000000/ file_11_00.jpg file_11_01.jpg file_12_00.jpg What I want to do is run rsync only on files that begin with "file_11_" in the subdirectories and I want to be able

How to REALLY strip a binary in MacOs

人走茶凉 提交于 2019-11-29 19:30:24
问题 MacOs 10.6, if I have a file "unwanted.c" which contains: class secret_thing { public: secret_thing() {} void revealing_method_name() {} }; main() { secret_thing obj; obj.revealing_method_name(); } Now I do: $ g++ unwanted.c -o unwanted $ strip unwanted $ nm unwanted | grep secret 0000000100000eb8 T __ZN12secret_thing21revealing_method_nameEv 0000000100000eae T __ZN12secret_thingC1Ev If I split out the interface and implementation of the secret class, as most people do when writing C++ code,

An objcopy equivalent for Mac / iPhone?

耗尽温柔 提交于 2019-11-29 05:30:24
I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool. I found no arm-apple-darwin10-objcopy . I tried the MacPorts' arm-elf-binutils port and also tried to play a bit with otool and segedit without much success. Any ideas please? synthesizerpatel Sounds like a job for Agner Fog's objconv . From the announcement : I have now finished making full support for Mach-O files in the object file converter mentioned in my previous posts. You may use it as a replacement for the missing objcopy utility. Objconv

How to enable C++17 on Mac?

你说的曾经没有我的故事 提交于 2019-11-29 02:28:31
问题 I am able to update gcc on Linux to get -std=c++17 but cannot do the same on Mac. Is there a version of Clang I can update to or some other alternative to get C++17 on my Mac? Please help. Thanks. 回答1: On my 10.11 El Capitan, Xcode 7.3.1, clang has been updated to: Apple LLVM version 7.3.0 (clang-703.0.31) which is almost equivalent to llvm version 3.8. clang++ hasn't -std=c++17 option, but -std=c++1z , working well at present, though only supporting some features of C++1z. For gcc, you can

技术分享 | 如何使用 dbdeployer 快速搭建 MySQL 测试环境

断了今生、忘了曾经 提交于 2019-11-29 01:57:29
作者:余振兴 一、工具介绍 dbdeployer 是一款十分强大的数据库测试环境部署工具,可实现一键部署不同架构、不同版本的数据库环境。 如:MySQL 主从复制、GTID 模式复制、MySQL 组复制(单主模式、多主模式等) 完整的数据库类型支持及版本,可在安装完 dbdeployer 后使用 dbdeployer admin capabilities 命令进行查看,以下是当前已支持数据库及组件类型 Oracle MySQL Percona MySQL MariaDB TiDB MySQL NDB Cluster Percona XtraDB Cluster mysql-shell 本文主要介绍基于 dbdeployer 工具快速搭建 MySQL 测试环境以及 dbdeployer 的基础使用。完整的功能特性以及使用方式可查看 dbdeployer 文档手册,dbdeployer 的文档手册十分详细的介绍了该工具特性及各类使用方式,可查看文末的相关链接。 二、工具安装 本文以 MacOS 下部署为例,Linux 平台安装部署方式基本类似( 该工具不提供 Windows 版本 ),可访问 https://github.com/datacharmer/dbdeployer/releases 获取最新版 dbdeployer 下载链接,以下内容中 shell> 表示命令行提示符 ```

How can I use mach_absolute_time without overflowing?

时光毁灭记忆、已成空白 提交于 2019-11-28 23:30:47
On Darwin, the POSIX standard clock_gettime(CLOCK_MONOTONIC) timer is not available. Instead, the highest resolution monotonic timer is obtained through the mach_absolute_time function from mach/mach_time.h . The result returned may be an unadjusted tick count from the processor, in which case the time units could be a strange multiple. For example, on a CPU with a 33MHz tick count, Darwin returns 1000000000/33333335 as the exact units of the returned result (ie, multiply the mach_absolute_time by that fraction to obtain a nanosecond value). We usually wish to convert from exact ticks to

An objcopy equivalent for Mac / iPhone?

a 夏天 提交于 2019-11-27 23:04:10
问题 I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool. I found no arm-apple-darwin10-objcopy . I tried the MacPorts' arm-elf-binutils port and also tried to play a bit with otool and segedit without much success. Any ideas please? 回答1: Sounds like a job for Agner Fog's objconv. From the announcement: I have now finished making full support for Mach-O files in the object file converter mentioned in my